Re: procedure string constant is parsed at procedure create time.

2023-11-07 Thread Tom Lane
Alvaro Herrera writes: > On 2023-Nov-07, jian he wrote: >> 2.this will have errors. > The problem seems to be that the procedure uses a single catalog > snapshot during execution, so the INSERT doesn't see the table that > CREATE has made. It looks to me like fmgr_sql does take a new snapsho

Re: procedure string constant is parsed at procedure create time.

2023-11-07 Thread David G. Johnston
On Tuesday, November 7, 2023, jian he wrote: > > > Why does the 2nd query fail? What am I missing? > > The language specific implementation detail note on this page. https://www.postgresql.org/docs/current/xfunc-sql.html David J.

Re: procedure string constant is parsed at procedure create time.

2023-11-07 Thread Alvaro Herrera
On 2023-Nov-07, jian he wrote: > 2.this will have errors. > CREATE or replace PROCEDURE template_create() LANGUAGE SQL AS $proc$ > DROP TABLE if exists test cascade; > CREATE TABLE test(id int4range,valid_at tsrange,name text); > INSERT INTO test VALUES (NULL, tsrange('2018-01-01',

procedure string constant is parsed at procedure create time.

2023-11-07 Thread jian he
hi. table "test" does not exist. ---1.this will work. CREATE or replace PROCEDURE template_create() LANGUAGE SQL AS $proc$ DROP TABLE if exists test cascade; CREATE TABLE test(id int4range,valid_at tsrange,name text);$proc$; 2.this will have errors. CREATE or replace PROCEDURE template_create