Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHZTZ-0002uW-IM for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Nov 2017 18:10:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHZTY-00027h-RO for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Nov 2017 18:10:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eHZTY-00027A-Ip for pgsql-hackers@lists.postgresql.org; Wed, 22 Nov 2017 18:10:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eHZTW-0004fR-5O for pgsql-hackers@postgresql.org; Wed, 22 Nov 2017 18:10:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAMIAGXV027202; Wed, 22 Nov 2017 13:10:16 -0500 From: Tom Lane To: Peter Eisentraut cc: Andrew Dunstan , pgsql-hackers , Simon Riggs Subject: Re: [HACKERS] SQL procedures In-reply-to: <67fa3f8d-7203-702b-40a3-514eba7e1c05@2ndquadrant.com> References: <336f6926-8990-ff2d-4167-276ce417fc32@2ndquadrant.com> <492a8be0-ff55-3858-7dc1-62fa07d444c2@2ndquadrant.com> <6fbe425b-0b9b-0b3f-c5bb-5a5111514867@2ndquadrant.com> <67fa3f8d-7203-702b-40a3-514eba7e1c05@2ndquadrant.com> Comments: In-reply-to Peter Eisentraut message dated "Wed, 22 Nov 2017 13:01:22 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27200.1511374216.1@sss.pgh.pa.us> Date: Wed, 22 Nov 2017 13:10:16 -0500 Message-ID: <27201.1511374216@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Eisentraut 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