From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Julien Rouhaud <rjuju123(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Andres Freund <andres(at)anarazel(dot)de>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: SQL-standard function body |
Date: | 2021-04-10 03:30:14 |
Message-ID: | 20210410033014.GA993491@rfd.leadboat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2021-04-10 04:20:16 | Re: Replication slot stats misgivings |
Previous Message | Noah Misch | 2021-04-10 03:07:10 | Re: pgsql: Move tablespace path re-creation from the makefiles to pg_regres |