Void binary patch

Started by Radosław Smoguraalmost 15 years ago10 messages
#1Radosław Smogura
rsmogura@softperience.eu
1 attachment(s)

Just patch for missing procedures for void send/recv

Regards,
Radek

Attachments:

void_binary.patchtext/x-patch; charset=UTF-8; name=void_binary.patchDownload
diff --git a/src/backend/utils/adt/pseudotypes.c b/src/backend/utils/adt/pseudotypes.c
index d9329f8..614eb98 100644
--- a/src/backend/utils/adt/pseudotypes.c
+++ b/src/backend/utils/adt/pseudotypes.c
@@ -212,7 +212,20 @@ void_out(PG_FUNCTION_ARGS)
 	PG_RETURN_CSTRING(pstrdup(""));
 }
 
+Datum
+void_recv(PG_FUNCTION_ARGS)
+{
+    PG_RETURN_VOID();
+}
 
+Datum
+void_send(PG_FUNCTION_ARGS)
+{
+	StringInfoData buf;
+
+        pq_begintypsend(&buf); //Nice machinery to send nothing
+	PG_RETURN_BYTEA_P(pq_endtypsend(&buf));
+}
 /*
  * trigger_in		- input routine for pseudo-type TRIGGER.
  */
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 0894985..0711474 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -4226,6 +4226,11 @@ DATA(insert OID = 2502 (  anyarray_recv		   PGNSP PGUID 12 1 0 0 f f f t f s 1 0
 DESCR("I/O");
 DATA(insert OID = 2503 (  anyarray_send		   PGNSP PGUID 12 1 0 0 f f f t f s 1 0 17 "2277" _null_ _null_ _null_ _null_	anyarray_send _null_ _null_ _null_ ));
 DESCR("I/O");
+DATA(insert OID = 3120 (  void_recv		   PGNSP PGUID 12 1 0 0 f f f t f s 1 0 2278 "2281" _null_ _null_ _null_ _null_ void_recv _null_ _null_ _null_ ));
+DESCR("I/O");
+DATA(insert OID = 3121 (  void_send		   PGNSP PGUID 12 1 0 0 f f f t f s 1 0 17 "2278" _null_ _null_ _null_ _null_	void_send _null_ _null_ _null_ ));
+DESCR("I/O");
+
 
 /* System-view support functions with pretty-print option */
 DATA(insert OID = 2504 (  pg_get_ruledef	   PGNSP PGUID 12 1 0 0 f f f t f s 2 0 25 "26 16" _null_ _null_ _null_ _null_	pg_get_ruledef_ext _null_ _null_ _null_ ));
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index 0f7312e..9baed6c 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -615,7 +615,7 @@ DATA(insert OID = 2276 ( any			PGNSP PGUID  4 t p P f t \054 0 0 0 any_in any_ou
 #define ANYOID			2276
 DATA(insert OID = 2277 ( anyarray		PGNSP PGUID -1 f p P f t \054 0 0 0 anyarray_in anyarray_out anyarray_recv anyarray_send - - - d x f 0 -1 0 0 _null_ _null_ ));
 #define ANYARRAYOID		2277
-DATA(insert OID = 2278 ( void			PGNSP PGUID  4 t p P f t \054 0 0 0 void_in void_out - - - - - i p f 0 -1 0 0 _null_ _null_ ));
+DATA(insert OID = 2278 ( void			PGNSP PGUID  4 t p P f t \054 0 0 0 void_in void_out void_recv void_send - - - i p f 0 -1 0 0 _null_ _null_ ));
 #define VOIDOID			2278
 DATA(insert OID = 2279 ( trigger		PGNSP PGUID  4 t p P f t \054 0 0 0 trigger_in trigger_out - - - - - i p f 0 -1 0 0 _null_ _null_ ));
 #define TRIGGEROID		2279
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 8392be6..8652ba0 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -504,6 +504,8 @@ extern Datum anyenum_in(PG_FUNCTION_ARGS);
 extern Datum anyenum_out(PG_FUNCTION_ARGS);
 extern Datum void_in(PG_FUNCTION_ARGS);
 extern Datum void_out(PG_FUNCTION_ARGS);
+extern Datum void_recv(PG_FUNCTION_ARGS);
+extern Datum void_send(PG_FUNCTION_ARGS);
 extern Datum trigger_in(PG_FUNCTION_ARGS);
 extern Datum trigger_out(PG_FUNCTION_ARGS);
 extern Datum language_handler_in(PG_FUNCTION_ARGS);
#2David Fetter
david@fetter.org
In reply to: Radosław Smogura (#1)
Re: Void binary patch

On Sun, Feb 20, 2011 at 11:20:22AM +0100, Radosław Smogura wrote:

Just patch for missing procedures for void send/recv

Regards,
Radek

Thanks! :)

Style note: the project doesn't use // as a comment-to-end-of-line in
C because some supported compilers don't understand it.

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

#3Robert Haas
robertmhaas@gmail.com
In reply to: Radosław Smogura (#1)
Re: Void binary patch

On Sun, Feb 20, 2011 at 5:20 AM, Radosław Smogura
<rsmogura@softperience.eu> wrote:

Just patch for missing procedures for void send/recv

What problem does this fix?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

#4rsmogura
rsmogura@softperience.eu
In reply to: Robert Haas (#3)
Re: Void binary patch

On Tue, 22 Feb 2011 07:01:02 -0500, Robert Haas wrote:

On Sun, Feb 20, 2011 at 5:20 AM, Radosław Smogura
<rsmogura@softperience.eu> wrote:

Just patch for missing procedures for void send/recv

What problem does this fix?

Can not execute stored procedures in JDBC with out arguments, I think
function retuning void as well, and some other "minors". Ofc with binary
mode.

Regards,
Radek

#5Merlin Moncure
mmoncure@gmail.com
In reply to: Robert Haas (#3)
Re: Void binary patch

On Tue, Feb 22, 2011 at 6:01 AM, Robert Haas <robertmhaas@gmail.com> wrote:

On Sun, Feb 20, 2011 at 5:20 AM, Radosław Smogura
<rsmogura@softperience.eu> wrote:

Just patch for missing procedures for void send/recv

What problem does this fix?

void returning functions may not be called when binary protocol is
requested currently. this is annoying: some drivers that wrap libpq
or the protocol directly use the binary mode exclusively and this
causes headaches for them. put another way, 'void' is the only POD
type missing send/recv.

merlin

#6rsmogura
rsmogura@softperience.eu
In reply to: Merlin Moncure (#5)
Re: Void binary patch

On Tue, 22 Feb 2011 08:12:23 -0600, Merlin Moncure wrote:

On Tue, Feb 22, 2011 at 6:01 AM, Robert Haas <robertmhaas@gmail.com>
wrote:

On Sun, Feb 20, 2011 at 5:20 AM, Radosław Smogura
<rsmogura@softperience.eu> wrote:

Just patch for missing procedures for void send/recv

What problem does this fix?

void returning functions may not be called when binary protocol is
requested currently. this is annoying: some drivers that wrap libpq
or the protocol directly use the binary mode exclusively and this
causes headaches for them. put another way, 'void' is the only POD
type missing send/recv.

merlin

Just curious what POD means?

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Merlin Moncure (#5)
Re: Void binary patch

Merlin Moncure <mmoncure@gmail.com> writes:

On Tue, Feb 22, 2011 at 6:01 AM, Robert Haas <robertmhaas@gmail.com> wrote:

What problem does this fix?

void returning functions may not be called when binary protocol is
requested currently. this is annoying: some drivers that wrap libpq
or the protocol directly use the binary mode exclusively and this
causes headaches for them. put another way, 'void' is the only POD
type missing send/recv.

Yeah, this has been discussed before.

Even though this patch is far past the CF deadline, I'm a bit tempted to
push it into 9.1 anyway, just so we can check off that problem.

regards, tom lane

#8Robert Haas
robertmhaas@gmail.com
In reply to: Tom Lane (#7)
Re: Void binary patch

On Tue, Feb 22, 2011 at 10:15 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Merlin Moncure <mmoncure@gmail.com> writes:

On Tue, Feb 22, 2011 at 6:01 AM, Robert Haas <robertmhaas@gmail.com> wrote:

What problem does this fix?

void returning functions may not be called when binary protocol is
requested currently.  this is annoying: some drivers that wrap libpq
or the protocol directly use the binary mode exclusively and this
causes headaches for them.  put another way, 'void' is the only POD
type missing send/recv.

Yeah, this has been discussed before.

Even though this patch is far past the CF deadline, I'm a bit tempted to
push it into 9.1 anyway, just so we can check off that problem.

+1.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

#9Merlin Moncure
mmoncure@gmail.com
In reply to: rsmogura (#6)
Re: Void binary patch

On Tue, Feb 22, 2011 at 8:22 AM, rsmogura <rsmogura@softperience.eu> wrote:

On Tue, 22 Feb 2011 08:12:23 -0600, Merlin Moncure wrote:

On Tue, Feb 22, 2011 at 6:01 AM, Robert Haas <robertmhaas@gmail.com>
wrote:

On Sun, Feb 20, 2011 at 5:20 AM, Radosław Smogura
<rsmogura@softperience.eu> wrote:

Just patch for missing procedures for void send/recv

What problem does this fix?

void returning functions may not be called when binary protocol is
requested currently.  this is annoying: some drivers that wrap libpq
or the protocol directly use the binary mode exclusively and this
causes headaches for them.  put another way, 'void' is the only POD
type missing send/recv.

merlin

Just curious what POD means?

POD = 'Plain Old Data' -- one of the core types. :-).

merlin

#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: Robert Haas (#8)
Re: Void binary patch

Robert Haas <robertmhaas@gmail.com> writes:

On Tue, Feb 22, 2011 at 10:15 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Yeah, this has been discussed before.

Even though this patch is far past the CF deadline, I'm a bit tempted to
push it into 9.1 anyway, just so we can check off that problem.

+1.

Done.

regards, tom lane