Re: BUG #19072: New-style SQL language function referencing a temp table behaves oddly

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: bernice.southey@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2025-10-04T17:26:00Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> When created in psql, a new-style SQL language function referencing a temp
> table disappears with the session, as if it were a temporary function.

Yeah, this is expected, since the parser will create a pg_depend
linkage from the function to the temp table.

> When created in pgAdmin, the function survives.

Really?  I don't use pgAdmin, but I don't see how it could affect the
object dependency rules.  Perhaps it's not closing the originating
session when you think it is?

There is a nearby thread proposing forbidding new-style functions
from having dependencies on temp objects [1].  Curious to know if
you think that'd be a good answer.

			regards, tom lane

[1] https://www.postgresql.org/message-id/flat/19cf6ae1-04cd-422c-a760-d7e75fe6cba9%40uni-muenster.de