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-31 08:34:23
Message-ID: 4116205B-5E5D-447F-8A78-EE07E8ECE545@commandprompt.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Jan 29, 2011, at 12:27 AM, Alex Hunsaker wrote:

> On Thu, Jan 27, 2011 at 03:38, Alexey Klyukin <alexk(at)commandprompt(dot)com> wrote:
>> Hi,
>> 
>> On Jan 27, 2011, at 9:31 AM, Alex Hunsaker wrote:
>> 
>>> Find attached v3 of the patch.  changes include:
>>> - fix deep recursion due to accidental reversal of check in encode_array_literal
>>> - add proper support for stringifying composite/row types.  I did not
>>> find a good way to quote these from the perl on the fly, so instead we
>>> compute it the same way we used to and store the string inside the new
>>> object along with the array :(.
>>> - misc whitespace and code touchups
>>> <pg_to_perl_arrays_v3.patch.gz>
>> 
>> 
>> Nice improvement. It passes all the regression tests on my OS X system. I have only a minor suggestion, I think is_array is worth mentioning in the utility functions chapter of the pl/perl documentation, it would be also more clear to use it in regression tests as opposed to manually checking whether the ref is equal to  'PostgreSQL::InServer::ARRAY'.
> 
> Wait a second...  Just who is reviewing who's patch? :P
> 

Oh, sorry, got confused along the way :)

> Both done in the attached.  I also renamed is_array() to
> is_array_ref() for clarity (hopefully).
> <pg_to_perl_arrays_v4.patch.gz>

Thank you.

I've looked at the patch and added a test for arrays exceeding or equal maximum dimensions to check, whether the recursive function won't bring surprises there. I've also added check_stack_depth calls to both split_array and plperl_hash_from_tuple. Note that the regression fails currently due to the incorrect error reporting in
PostgreSQL, per http://archives.postgresql.org/pgsql-hackers/2011-01/msg02888.php.

The v5 is attached.


Attachment: pg_to_perl_arrays_v5.patch.gz
Description: application/x-gzip (6.5 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Jürgen WolfsgruberDate: 2011-01-31 09:16:22
Subject: Problem with postgresql database connection in combination with HUAWEI data modem
Previous:From: Jörg Roman RudnickDate: 2011-01-31 08:32:54
Subject: [pgsql-general 2011-1-21:] Are there any projects interested in object functionality? (+ rule bases)

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