Re: pl/perl example in the doc no longer works in 9.1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alex Hunsaker <badalex(at)gmail(dot)com>
Cc: "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Amit Khandekar <amit(dot)khandekar(at)enterprisedb(dot)com>, hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Alexey Klyukin <alexk(at)commandprompt(dot)com>
Subject: Re: pl/perl example in the doc no longer works in 9.1
Date: 2011-10-13 18:02:34
Message-ID: 20175.1318528954@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alex Hunsaker <badalex(at)gmail(dot)com> writes:
> On Wed, Oct 12, 2011 at 15:33, Alex Hunsaker <badalex(at)gmail(dot)com> wrote:
>> On Wed, Oct 12, 2011 at 15:00, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> The core of the problem seems to be that if SvROK(sv) then
>>> the code assumes that it must be intended to convert that to an array or
>>> composite, no matter whether the declared result type of the function is
>>> compatible with such a thing.

> PFA my attempt at a fix.

> This gets rid of of most of the if/else chain and the has_retval crap
> in plperl_handl_func(). Instead we let plperl_sv_to_datum() do most of
> the lifting. It also now handles VOIDOID and checks that the request
> result oid can be converted from the perl structure. For example if
> you passed in a hashref with a result oid that was not an rowtype it
> will error out with "PL/Perl cannot convert hash to non rowtype %s".
> Arrays behave similarly.

I'm working through this patch now. Does anyone object to having the
array-to-non-array-result-type and hash-to-non-rowtype-result-type cases
throw errors, rather than returning the rather useless ARRAY(...) and
HASH(...) strings as pre-9.1 did?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2011-10-13 18:03:33 Re: Additional supplied modules
Previous Message Bruce Momjian 2011-10-13 17:09:07 Re: [BUGS] BUG #6034: pg_upgrade fails when it should not.