From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | plperl returning setof foo[] |
Date: | 2009-09-12 17:17:50 |
Message-ID: | 4AABD7BE.60603@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I have just noticed, somewhat to my chagrin, that while in a plperl
function that returns an array type you can return a perl arrayref, like
this:
return [qw(a b c)];
if the function returns a setof an array type you cannot do this:
return_next [qw(a b c)];
Now the plperl docs say:
Perl can return PostgreSQL arrays as references to Perl arrays. Here
is an example:
CREATE OR REPLACE function returns_array()
RETURNS text[][] AS $$
return [['a"b','c,d'],['e\\f','g']];
$$ LANGUAGE plperl;
select returns_array();
and while it doesn't specifically mention SRFs it doesn't exclude them,
either.
The fix is fairly small (see attached) although I need to check with
some perlguts guru to see if I need to decrement a refcounter here or there.
Nobody has complained about it over the years, so I wonder if it should
be backpatched. It wouldn't change any working behaviour, just remove
the non-working property of some documented behaviour.
cheers
andrew
Attachment | Content-Type | Size |
---|---|---|
plperl-arrayfix.patch | text/x-patch | 961 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-09-12 17:30:59 | Re: plperl returning setof foo[] |
Previous Message | Tom Lane | 2009-09-12 15:57:00 | Re: COPY enhancements |