Calling PLpgSQL function with composite type fails with an error: "ERROR: could not open relation with OID ..."

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Calling PLpgSQL function with composite type fails with an error: "ERROR: could not open relation with OID ..."
Date: 2019-12-26 10:27:18
Message-ID: CAE9k0Pkd4dZwt9J5pS9xhJFWpUtqs05C9xk_GEwPzYdV=GxwWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,

When the following test-case is executed on master, it fails with an
error: "ERROR: could not open relation with OID ..."

-- create a test table:
create table tab1(a int, b text);

-- create a test function:
create or replace function f1() returns void as
$$
declare
var1 tab1;
begin
select * into var1 from tab1;
end
$$ language plpgsql;

-- call the test function:
select f1();

-- drop the test table and re-create it:
drop table tab1;
create table tab1(a int, b text);

-- call the test function:
select f1();

-- call the test function once again:
select f1(); -- this fails with an error "ERROR: could not open
relation with OID .."

I'm trying to investigate this issue and will try to share my findings soon...

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2019-12-26 11:05:25 Re: Minimal logical decoding on standbys
Previous Message Guillaume Lelarge 2019-12-26 09:31:06 Re: Expose lock group leader pid in pg_stat_activity