pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: SQL-standard function body
Date: Sun, 18 Apr 2021 17:33:38 -0400
Message-ID: <142618.1618781618@sss.pgh.pa.us> (raw)
In-Reply-To: <20210418211505.GA7256@telsasoft.com>
References: <1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com>
	<CA+TgmoZ-FXU0iyevFETN0sGYw0RKTSCFxKONGE+2nVJEM5_8OQ@mail.gmail.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>

... 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





view thread (90+ messages)  latest in thread

Message-ID: <142618.1618781618@sss.pgh.pa.us>
Permalink:  ../142618.1618781618@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/142618.1618781618@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pryzby@telsasoft.com, noah@leadboat.com, peter.eisentraut@2ndquadrant.com, robertmhaas@gmail.com
  Subject: Re: SQL-standard function body
  In-Reply-To: <142618.1618781618@sss.pgh.pa.us>
  References: <1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com> <CA+TgmoZ-FXU0iyevFETN0sGYw0RKTSCFxKONGE+2nVJEM5_8OQ@mail.gmail.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> <142618.1618781618@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox