Re: PL/Perl list value return causes segfault
От | David Fetter |
---|---|
Тема | Re: PL/Perl list value return causes segfault |
Дата | |
Msg-id | 20050712210136.GA22301@fetter.org обсуждение исходный текст |
Ответ на | Re: PL/Perl list value return causes segfault (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: PL/Perl list value return causes segfault
|
Список | pgsql-hackers |
On Tue, Jul 12, 2005 at 03:45:55PM -0400, Andrew Dunstan wrote: > > > Alvaro Herrera wrote: > > >On Tue, Jul 12, 2005 at 02:59:37PM -0400, Andrew Dunstan wrote: > > > > > > > >>Note that all plperl functions are called in scalar context, and > >>it is always wrong to return a list (as opposed to a listref). In > >>fact, the value received might surprise you even if it worked (it > >>would be the value of the last member of the list). > > > >Hmm, I don't know if it's feasible to do in Perl, but maybe check > >whether the function wants to return something in list context and > >throw an appropiate error message? > > 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? Cheers, D -- David Fetter david@fetter.org http://fetter.org/ phone: +1 510 893 6100 mobile: +1 415 235 3778 Remember to vote!
В списке pgsql-hackers по дате отправления: