Re: PL/Perl list value return causes segfault

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: David Fetter <david(at)fetter(dot)org>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PL/Perl list value return causes segfault
Date: 2005-07-12 22:41:53
Message-ID: 42D44731.90306@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers pgsql-patches

David Fetter wrote:

>On Tue, Jul 12, 2005 at 03:45:55PM -0400, Andrew Dunstan wrote:
>
>
>>
>>In perl, if there is any ambiguity it is the called function that is
>>responsible for checking, not the caller. See "perldoc -f
>>wantarray". PLPerl explicitly passed G_SCALAR as a flag on all
>>calls to plperl routines. So returning a list is a case of pilot
>>error.
>>
>>
>
>Is this a kind of pilot error that documents could help avert in some
>useful way?
>
>
>
>

Sure. "A plperl function must always return a scalar value.More complex
structures (arrays, records, and sets) can be returned in the
appropriate context by returning a reference. A list should never be
returned." Salt to taste and insert where appropriate.

cheers

andrew

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Michael Fuhr 2005-07-12 23:59:18 Re: PL/Perl list value return causes segfault
Previous Message David Fetter 2005-07-12 21:01:36 Re: PL/Perl list value return causes segfault

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-07-12 23:59:18 Re: PL/Perl list value return causes segfault
Previous Message Denis Lussier 2005-07-12 22:07:47 Re: dbt2 & opteron performance

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2005-07-12 23:34:55 Re: Autovacuum integration
Previous Message Andrew Dunstan 2005-07-12 22:01:41 Re: SQLException: Cannot be less than zero