diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-02-22 13:08:22 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-02-22 13:08:22 -0500 |
commit | 1ab9b012bdf1f106792fc523e21b9ca8299bb8ed (patch) | |
tree | 088398d9ed9d5e03cbdeb1c9170b7ae6774498aa /src/backend | |
parent | edb382179d49105a236b54678a5a4020276df071 (diff) | |
download | postgresql-1ab9b012bdf1f106792fc523e21b9ca8299bb8ed.tar.gz postgresql-1ab9b012bdf1f106792fc523e21b9ca8299bb8ed.zip |
Allow binary I/O of type "void".
void_send is useful for the same reason that void_out doesn't throw error,
namely that someone might do "select void_returning_func(...)" from a
client that prefers to operate in binary mode. The void_recv function may
or may not have any practical use, but we provide it for symmetry.
Radosław Smogura
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/utils/adt/pseudotypes.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/backend/utils/adt/pseudotypes.c b/src/backend/utils/adt/pseudotypes.c index d9329f83428..ddb1bd2b71c 100644 --- a/src/backend/utils/adt/pseudotypes.c +++ b/src/backend/utils/adt/pseudotypes.c @@ -212,6 +212,34 @@ void_out(PG_FUNCTION_ARGS) PG_RETURN_CSTRING(pstrdup("")); } +/* + * void_recv - binary input routine for pseudo-type VOID. + * + * Note that since we consume no bytes, an attempt to send anything but + * an empty string will result in an "invalid message format" error. + */ +Datum +void_recv(PG_FUNCTION_ARGS) +{ + PG_RETURN_VOID(); +} + +/* + * void_send - binary output routine for pseudo-type VOID. + * + * We allow this so that "SELECT function_returning_void(...)" works + * even when binary output is requested. + */ +Datum +void_send(PG_FUNCTION_ARGS) +{ + StringInfoData buf; + + /* send an empty string */ + pq_begintypsend(&buf); + PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); +} + /* * trigger_in - input routine for pseudo-type TRIGGER. |