From: Noah Misch <noah@leadboat.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Andres Freund <andres@anarazel.de>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Jaime Casanova <jcasanov@systemguards.com.ec>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: SQL-standard function body
Date: Fri, 9 Apr 2021 20:30:14 -0700
Message-ID: <20210410033014.GA993491@rfd.leadboat.com> (raw)
In-Reply-To: <2197698.1617984583@sss.pgh.pa.us>
References: <01c65ea6-e5bf-22f4-cacc-6d0f6853a965@2ndquadrant.com>
<1646498.1617826937@sss.pgh.pa.us>
<YG54YggzyPrTFE+e@paquier.xyz>
<1819824.1617858962@sss.pgh.pa.us>
<20210408052759.7bmyawm4djnrux6y@alap3.anarazel.de>
<1820954.1617860500@sss.pgh.pa.us>
<20210408063514.houn2s3yxcorukdf@alap3.anarazel.de>
<YG620HiF8Huz/YIn@paquier.xyz>
<20210408111121.lsh6cvwjgk6ku7m5@nol>
<2197698.1617984583@sss.pgh.pa.us>
On Fri, Apr 09, 2021 at 12:09:43PM -0400, Tom Lane wrote:
> Finally, 0003 might be a bit controversial: it changes the stored
> prosrc for new-style SQL functions to be the query text of the CREATE
> FUNCTION command. The main argument I can see being made against this
> is that it'll bloat the pg_proc entry. But I think that that's
> not a terribly reasonable concern
Such storage cost should be acceptable, but ...
> The real value of 0003 of course would be to get an error cursor at
> runtime
A key benefit of $SUBJECT is the function body following DDL renames:
create table foo ();
insert into foo default values;
create function count_it() returns int begin atomic return (select count(*) from foo); end;
select count_it();
insert into foo default values;
alter table foo rename to some_new_long_table_name;
select count_it(); -- still works
After the rename, any stored prosrc is obsolete. To show accurate error
cursors, deparse prosqlbody and use that in place of prosrc.
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: noah@leadboat.com, tgl@sss.pgh.pa.us, rjuju123@gmail.com, michael@paquier.xyz, andres@anarazel.de, peter.eisentraut@2ndquadrant.com, jcasanov@systemguards.com.ec, pgsql-hackers@lists.postgresql.org
Subject: Re: SQL-standard function body
In-Reply-To: <20210410033014.GA993491@rfd.leadboat.com>
* 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