Re: [PATCH] plpythonu datatype conversion improvements - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [PATCH] plpythonu datatype conversion improvements
Date
Msg-id 1250547033.22690.13.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: [PATCH] plpythonu datatype conversion improvements  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] plpythonu datatype conversion improvements
List pgsql-hackers
On mån, 2009-08-17 at 10:42 -0400, Tom Lane wrote:
> For the record, I think this entire patch is a bad idea.  PLs should not
> be so much in bed with the internal representation of datatypes.  To
> take just one example, this *will* break when/if we change text to carry
> some internal locale indicator.  There has been absolutely zero evidence
> presented to justify that there's a need to break abstraction to gain
> performance in this area.

The motivation for this patch has nothing to do with performance.  The
point is to pass data types into and out of PL/Python sensibly.  In
particular, passing bytea into and out of PL/Python is currently
completely broken, in the sense that what you get in Python is not a
byte string that you can process sensibly.

We could argue that peeking inside the internal representation of data
types might be inappropriate.  In which case the solution would be to
run the data through the data type output function and have PL/Python
parse that back in.  That would just be a localized change in the patch,
however.  (It might be less than ideal for passing float types,
perhaps.)  We do, however, expose a data types binary format through the
binary protocol, so perhaps we should be using the send/recv functions
instead of input/output.  Which would require hardcoding the bytea
binary format, at least.  Either of these solutions would probably solve
the domains problem, though.

Note also that we have historically broken the bytea text format twice
as often as the bytea binary format. ;-)



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: explain root element for auto-explain
Next
From: Peter Eisentraut
Date:
Subject: Re: Alpha 1 release notes