Skip site navigation (1) Skip section navigation (2)

Re: arrays as pl/perl input arguments [PATCH]

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: Alex Hunsaker <badalex(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, pgsql-hackers(at)postgresql(dot)org, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: arrays as pl/perl input arguments [PATCH]
Date: 2011-01-26 20:35:06
Message-ID: 578166A5-9E63-47E8-B363-62763E40BA11@commandprompt.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Jan 26, 2011, at 10:08 PM, Alex Hunsaker wrote:

> On Wed, Jan 26, 2011 at 12:44, Alexey Klyukin <alexk(at)commandprompt(dot)com> wrote:
>> Hi,
>> 
>> On Jan 26, 2011, at 8:45 PM, Alex Hunsaker wrote:
>> 
>>> On Sat, Jan 15, 2011 at 15:48, Alex Hunsaker <badalex(at)gmail(dot)com> wrote:
>>>> On Wed, Jan 12, 2011 at 13:04, Alexey Klyukin <alexk(at)commandprompt(dot)com> wrote:
>>>>> 
>>>>> On Jan 12, 2011, at 8:52 PM, David E. Wheeler wrote:
>>>>> 
>>>>>> On Jan 12, 2011, at 5:14 AM, Alexey Klyukin wrote:
>>>>>> 
>>>>>>> You mean packing both a string representation and a reference to a single SV * value?
>>>>>> 
>>>>>> Dunno, I'm not a guts guy.
>>>>> 
>>>>> Well, neither me (I haven't used much of the guts api there).
>>>> 
>>>> Find attached a proof of concept that modifies Alexey's patch to do
>>>> the above (using the overload example I and others posted).
>>> [ ... ]
>>>> Thoughts?  Should I polish this a bit more?  Or do we like the GUC better?
>>> 
>>> So its been over a week with no comments. ISTM there were more people
>>> against adding yet another GUC.  Barring objection ill finish the
>>> missing parts of the POC patch I posted and submit that.
>> 
>> I've played with that patch just today. I found a problem with it, when I tried to use the array in a string context the backend segfaulted with: "WARNING:  Deep recursion on subroutine "main::encode_array_literal" at -e line 74" just before the segfault. I think the problem is in the regexp check in 'encode_array_literal' (it's obviously reversed comparing with the original one),
> 
> Yeah, I noticed that after I sent it out :(.
> 
>> but it still segfaults after I fixed that.
> 
> I seem to recall fixing this post email as well... Can you provide the
> function that broke so I can double check? (Or was it part of the
> regression test?)

Sure, it's really simple (and the plperl_array regressions tests exposes this problem as well):

CREATE OR REPLACE FUNCTION test_array(INTEGER[]) RETURNS TEXT AS $$
        my $array = shift;
        print "$array"."\n";
$$ LANGUAGE plperl;

/A

I will look into this problem  tomorrow unless you'll be  lucky to fix it before that. Thank you for the review and your patch.

--
Alexey Klyukin
The PostgreSQL Company - Command Prompt, Inc.





In response to

Responses

pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2011-01-26 20:36:25
Subject: Re: SSI patch version 14
Previous:From: Joshua D. DrakeDate: 2011-01-26 20:29:23
Subject: Re: [HACKERS] Seeking Mentors for Funded Reviewers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group