From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: cstork+postgresql@gmail.com
Subject: BUG #18131: PL/pgSQL: regclass procedure parameter wrongly memoized(?)
Date: Fri, 22 Sep 2023 19:22:34 +0000
Message-ID: <18131-576854e79c5cd264@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 18131
Logged by: Christian Stork
Email address: cstork+postgresql@gmail.com
PostgreSQL version: 14.9
Operating system: Ubuntu 22.04
Description:
The following condensed recipe reproduces the error:
create procedure callee(t regclass)
language plpgsql as
$body$
begin
raise notice 'callee: oid = %', t::oid;
execute 'table ' || t;
end;
$body$;
create procedure caller()
language plpgsql as
$body$
begin
create table table_name ();
raise notice 'caller: oid = %', 'table_name'::regclass::oid;
call callee('table_name');
drop table table_name;
end;
$body$;
call caller(); -- OK
call caller(); -- ERROR: callee executed with OID of previous invocation!
-- Relevant output (Ubuntu 14.9-1.pgdg22.04+1):
-- ...
-- NOTICE: caller: oid = 24769724
-- NOTICE: callee: oid = 24769724
-- CALL <---- first statement completed
successfully
-- NOTICE: caller: oid = 24769727
-- NOTICE: callee: oid = 24769724 <---- should be the same as line
above
-- ERROR: syntax error at or near "24769724"
-- LINE 1: table 24769724 <---- no more table with this OID in
pg_catalog, hence OID instead of table name, I assume
-- ...
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-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, cstork+postgresql@gmail.com
Subject: Re: BUG #18131: PL/pgSQL: regclass procedure parameter wrongly memoized(?)
In-Reply-To: <18131-576854e79c5cd264@postgresql.org>
* 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