Re: SQL-standard function body - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SQL-standard function body
Date
Msg-id 142618.1618781618@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL-standard function body  (Justin Pryzby <pryzby@telsasoft.com>)
Responses Re: SQL-standard function body  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List pgsql-hackers
... 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



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: SQL-standard function body
Next
From: Mark Dilger
Date:
Subject: Re: pg_amcheck option to install extension