Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYF38-0005yJ-5T for pgsql-hackers@arkaria.postgresql.org; Sun, 18 Apr 2021 21:33:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lYF36-00069a-6m for pgsql-hackers@arkaria.postgresql.org; Sun, 18 Apr 2021 21:33:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYF36-00069T-09 for pgsql-hackers@lists.postgresql.org; Sun, 18 Apr 2021 21:33:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYF2z-0004MD-I0 for pgsql-hackers@postgresql.org; Sun, 18 Apr 2021 21:33:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 13ILXcpU142619; Sun, 18 Apr 2021 17:33:38 -0400 From: Tom Lane To: Justin Pryzby cc: Noah Misch , Peter Eisentraut , Robert Haas , pgsql-hackers@postgresql.org Subject: Re: SQL-standard function body In-reply-to: <20210418211505.GA7256@telsasoft.com> References: <1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com> <493812.1593541480@sss.pgh.pa.us> <494838.1593543098@sss.pgh.pa.us> <20210418185546.GC1500781@rfd.leadboat.com> <92408.1618772924@sss.pgh.pa.us> <20210418211505.GA7256@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Sun, 18 Apr 2021 16:15:05 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <142617.1618781618.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 18 Apr 2021 17:33:38 -0400 Message-ID: <142618.1618781618@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ... BTW, a dependency loop is also possible without using this feature, by abusing default-value expressions: create function f1(x int, y int) returns int language sql as 'select $1 + $2'; create function f2(x int, y int default f1(1,2)) returns int language sql as 'select $1 + $2'; create or replace function f1(x int, y int default f2(11,12)) returns int = language sql as 'select $1 + $2'; The actual use-case for that seems pretty thin, so we never bothered to worry about it before. But if we're going to build loop-breaking logic to handle function body dependencies, it should deal with this too. I think that all that's required is for the initial dummy function declaration to omit defaults as well as providing a dummy body. regards, tom lane