Re: plperl vs. bytea

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Theo Schlossnagle <jesus(at)omniti(dot)com>
Subject: Re: plperl vs. bytea
Date: 2007-05-07 14:48:14
Message-ID: 5569.1178549294@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2007-05-07 16:00:09 Re: psqlodbc - psqlodbc: Put Autotools-generated files into subdirectory
Previous Message Jim Nasby 2007-05-07 13:14:45 Re: New idea for patch tracking