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

From Tom Lane
Subject Re: plperl vs. bytea
Date
Msg-id 5569.1178549294@sss.pgh.pa.us
Whole thread Raw
In response to Re: plperl vs. bytea  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> 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.

> 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?

Pretty much everything is passed as text.  This is a historical
accident, in part: our first PL with an external interpreter was pltcl,
and Tcl of the day had no other variable type besides "text string".
(They've gotten smarter since then, but from a user's-eye point of view
it's still true that every value in Tcl is a string.)  So it was natural
to decree that the value transmission protocol was just to convert to
text and back with the SQL datatype I/O functions.  Later PLs copied
that decision without thinking hard about it.  We've wedged a few bits
of custom transmission protocol into plperl for arrays and records, but
it's been pretty ad-hoc each time.  Seems it's time to take a step back
and question the assumptions.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Jim Nasby
Date:
Subject: Re: New idea for patch tracking
Next
From: Jim Nasby
Date:
Subject: Re: [COMMITTERS] psqlodbc - psqlodbc: Put Autotools-generated files into subdirectory