Re: Transform groups - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Transform groups
Date
Msg-id 4980.1051644876@sss.pgh.pa.us
Whole thread Raw
In response to Transform groups  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> The SQL standard defines a concept called "transform groups", which are
> basically pairs of input/ouput functions that can be switched between.

> Is this something worth investigating?

Perhaps, but there is little time left to get it done for 7.4.  Can we
lay out a strategy that will let us add such things incrementally,
without another protocol break later?

What I had personally been planning to do was restore the typsend and
typreceive columns of pg_type, defined on the order of
typsend(mytype) returns byteatypreceive(bytea) returns mytype

and then define some simple conventions, probably network-byte-order
based, that these functions would be expected to adhere to for the
external binary representation.  The on-the-wire representation is
a network-byte-order length followed by whatever contents the
send routines put into their bytea results.

I don't think this would scale very well to multiple external
representations, though; sure you could define a switch somewhere, but
what are the odds that N different send/receive functions would all pay
attention to it?  And how would you know if they didn't?

The implementations of these functions would probably mostly depend on a
small set of conversion routines similar to the existing pq_getint and
pq_putint routines, so it might be possible to do simple things like
switching endianness in a centralized way.  But I'm not sure what
happens if you want bigger changes than that.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cygwin PostgreSQL CVS build issues
Next
From: prashanth@jibenetworks.com
Date:
Subject: Re: LISTEN/NOTIFY benchmarks?