Re: [PATCH] plpythonu datatype conversion improvements

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Caleb Welton <cwelton(at)greenplum(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] plpythonu datatype conversion improvements
Date: 2009-08-17 22:10:33
Message-ID: 1250547033.22690.13.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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. ;-)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2009-08-17 22:14:44 pgsql: Add release notes for 8.5alpha1
Previous Message Kevin Grittner 2009-08-17 21:54:15 Re: 8.5 development schedule