Something's busted in plpgsql composite-variable handling

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Something's busted in plpgsql composite-variable handling
Date: 2018-08-26 18:50:09
Message-ID: 13185.1535309409@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While answering someone's question I was motivated to try this:

regression=# create type comp_type as (f1 int, f2 int);
CREATE TYPE
regression=# create function foo(int) returns int language plpgsql as '
declare z comp_type;
begin
z.f1 = $1; z.f2 = $1+1;
return z.f1 + z.f2;
end';
CREATE FUNCTION
regression=# select foo(32);
foo
-----
65
(1 row)

regression=# drop type comp_type;
DROP TYPE
regression=# create type comp_type as (f1 int, f2 int);
CREATE TYPE
regression=# select foo(32);
ERROR: could not open relation with OID 52068
CONTEXT: PL/pgSQL function foo(integer) line 4 at assignment

That's not very nice. What's worse is that it works cleanly in v10,
making this a regression, no doubt caused by the hacking I did on
plpgsql's handling of composite variables.

I'll create an open item for this. I've not yet looked into it
in any more detail than observing the failure.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-08-26 20:09:37 Re: Something's busted in plpgsql composite-variable handling
Previous Message Tom Lane 2018-08-26 17:08:51 Multiple reporting of syslogger errors