Re: [HACKERS] SQL procedures

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: [HACKERS] SQL procedures
Date: 2017-11-22 18:10:16
Message-ID: 27201.1511374216@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> On 11/20/17 16:25, Andrew Dunstan wrote:
>> We should document where returned values in PL procedures are ignored
>> (plperl, pltcl) and where they are not (plpython, plpgsql). Maybe we
>> should think about possibly being more consistent here, too.

> Yeah, suggestions? I think it makes sense in PL/pgSQL and PL/Python to
> disallow return values that would end up being ignored, because the only
> way a return value could arise is if user code explicit calls
> RETURN/return. However, in Perl, the return value is the result of the
> last statement, so prohibiting a return value would be very
> inconvenient. (Don't know about Tcl.) So maybe the current behavior
> makes sense. Documentation is surely needed.

Tcl has the same approach as Perl: the return value of a proc is the
same as the value of its last command. There's no such thing as a
proc that doesn't return a value.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2017-11-22 18:46:12 Re: [HACKERS] SQL procedures
Previous Message Peter Eisentraut 2017-11-22 18:01:22 Re: [HACKERS] SQL procedures