PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> I have some SQL which works fine in 9.x and 10.x, but fails in 11.x and 12.x
> (I tested on various Docker images).
> One of the functions declares a variable whose type matches a temporary
> table. If I drop and recreate that temporary table twice in the same
> session, I get an error like: "ERROR: could not open relation with OID
> xxx". This occurs on the second call to the DoSomething() function after the
> temporary table has been recreated.
I've pushed a fix for this -
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=6070ccdd179f34efecc92d6679a141093df0f879
Thanks for the report!
regards, tom lane