Something's busted in plpgsql composite-variable handling - Mailing list pgsql-hackers

From Tom Lane
Subject Something's busted in plpgsql composite-variable handling
Date
Msg-id 13185.1535309409@sss.pgh.pa.us
Whole thread Raw
Responses Re: Something's busted in plpgsql composite-variable handling
List 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Multiple reporting of syslogger errors
Next
From: Tom Lane
Date:
Subject: Re: Something's busted in plpgsql composite-variable handling