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