Re: Workaround to get arrays for plperl

From: <Eugen(dot)Konkov(at)aldec(dot)com>
To: "CaT" <cat(at)zip(dot)com(dot)au>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Workaround to get arrays for plperl
Date: 2008-03-30 13:47:01
Message-ID: 046801c8926c$88d9fd90$1200a8c0@kharkov.localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Yes, It is dangerous. But there is no other way to get arrays for plperl
The doc says that all passed to plperl function are strings ((

Another strange is that that '{1,2,3,4}' looks as hash in perl
It will be more conviniet if arrays passed as '[1,2,3,4]' strings if PG can
not pass them as arrays

----- Original Message -----
From: "CaT" <cat(at)zip(dot)com(dot)au>
To: <Eugen(dot)Konkov(at)aldec(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Sent: Sunday, March 30, 2008 4:27 PM
Subject: Re: [BUGS] Workaround to get arrays for plperl

> On Sun, Mar 30, 2008 at 04:23:07PM +0300, Eugen(dot)Konkov(at)aldec(dot)com wrote:
>> It seems that function get arrays as strings in plperl.
>> This is a little workaround who want pass arrays to plperl functions
>>
>> my( $strarr )= @_;
>> $strarr =~ s/{/[/g;
>> $strarr =~ s/}/]/g;
>> my $arr= eval $strarr;
>>
>> NOTICE:
>> you must create you function as plperlu
>> and add language:
>> create language plperlu;
>
> It's late and I'm sleepy, but, that looks extremely hazardous to ones
> health. Esp if the arrays you speak of have any chance of containing
> anything that might look like perl code to begin with. ie think sql
> injection, but with perl code rather then sql.
>
> cat

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dave Page 2008-03-30 15:02:56 Re: BUG #4069: Wrong tip
Previous Message CaT 2008-03-30 13:27:19 Re: Workaround to get arrays for plperl