Re: plperl vs. bytea - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: plperl vs. bytea
Date
Msg-id 20070507102009.GA9410@svana.org
Whole thread Raw
In response to Re: plperl vs. bytea  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: plperl vs. bytea  (Tino Wildenhain <tino@wildenhain.de>)
Re: plperl vs. bytea  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, May 06, 2007 at 08:48:28PM -0400, Tom Lane wrote:
> What we've basically got here is a complaint that the default
> textual-representation-based method for transmitting PL function
> parameters and results is awkward and inefficient for bytea.
> So the first question is whether this is really localized to only
> bytea, and if not which other types have got similar issues.
> (Even if you make the case that no other scalar types need help,
> what of bytea[] and composite types containing bytea or bytea[]?)

I must say I was indeed surprised by the idea that bytea is passed by
text, since Perl handles embedded nulls in strings without any problem
at all. Does this mean integers are passed as text also? I would have
expected an array argument to be passed as an array, but now I'm not so
sure.

So I'm with Tom on this one: there needs to be a serious discussion
about how types are passed to Perl and the costs associated with it.

I do have one problem though: for bytea/integers/floats Perl has
appropriate internel representations. But what about other user-defined
types? Say the user-defined UUID type, it should probably also passed
by a byte string, yet how could Perl know that. That would imply that
user-defined types need to be able to specify how they are passed to
PLs, to *any* PL.

So fixing it for bytea is one thing, but there's a bigger issue here
that needs discussion.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: Zdenek Kotala
Date:
Subject: Re: Integer datetimes
Next
From: Tino Wildenhain
Date:
Subject: Re: plperl vs. bytea