X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 24ADA529BD for ; Tue, 12 Jul 2005 19:42:03 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14735-05 for ; Tue, 12 Jul 2005 22:42:02 +0000 (GMT) Received: from trolak.mydnsbox2.com (ns1.mydnsbox2.com [207.44.142.118]) by svr1.postgresql.org (Postfix) with ESMTP id 930CA529BC for ; Tue, 12 Jul 2005 19:41:59 -0300 (ADT) Received: from [192.168.1.103] (cpe-024-211-165-134.nc.res.rr.com [24.211.165.134]) (authenticated (0 bits)) by trolak.mydnsbox2.com (8.11.6/8.11.6) with ESMTP id j6CLu9628473; Tue, 12 Jul 2005 16:56:09 -0500 Message-ID: <42D44731.90306@dunslane.net> Date: Tue, 12 Jul 2005 18:41:53 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Fedora/1.7.8-1.3.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Fetter Cc: Alvaro Herrera , Michael Fuhr , pgsql-hackers@postgresql.org Subject: Re: PL/Perl list value return causes segfault References: <20050712130452.GA84564@winnie.fuhr.org> <42D41319.70107@dunslane.net> <20050712193303.GA14060@alvh.no-ip.org> <42D41DF3.6050702@dunslane.net> <20050712210136.GA22301@fetter.org> In-Reply-To: <20050712210136.GA22301@fetter.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.043 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/454 X-Sequence-Number: 70506 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