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

From Andrew Dunstan
Subject Re: plperl vs. bytea
Date
Msg-id 463F237F.7040106@dunslane.net
Whole thread Raw
In response to Re: plperl vs. bytea  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Tom Lane wrote:
>
>> My GUC proposal would have made it language+type specific, but Tom 
>> didn't like that approach.
>>     
>
> It may indeed need to be language+type specific; what I was objecting to
> was the proposal of an ad-hoc plperl-specific solution without any
> consideration for other languages (or other data types for that matter).
> I think that's working at the wrong level of detail, at least for
> initial design.
>
> 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[]?)
>   

Well, the proposal would have allowed the user to specify the types to 
be passed binary, so it wouldn't have been bytea only.

Array types are currently passed as text. This item used to be on the 
TODO list but it disappeared at some stage:

. Pass arrays natively instead of as text between plperl and postgres

(Perhaps it's naughty of me to observe that if we had a tracker we might 
know why it disappeared). Arrays can be returned as arrayrefs, and 
plperl has a little postprocessing magic that turns that into text which 
will in turn be parsed back into a postgres array. Not very efficient 
but it's a placeholder until we get better array support.

Composites are in fact passed as hashrefs and can be returned as 
hashrefs. Unfortunately, this is not true recursively - a composite 
within a composite will be received as text.

Another aspect of this is how we deal with SPI arguments and results.  I 
need to look into that, but sufficient unto the day ...


cheers

andrew


pgsql-hackers by date:

Previous
From: Koichi Suzuki
Date:
Subject: Re: Patch queue triage
Next
From: Jim Nasby
Date:
Subject: Re: temporal variants of generate_series()