mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
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
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user