Re: Add notification on BEGIN ATOMIC SQL functions using temp relations

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bernice Southey <bernice.southey@gmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>, "David G. Johnston" <david.g.johnston@gmail.com>, Pavel Stehule <pavel.stehule@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-22T18:04:21Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve detection of implicitly-temporary views.

  2. Issue a NOTICE if a created function depends on any temp objects.

Bernice Southey <bernice.southey@gmail.com> writes:
> Yikes. Can I get in early on the push-back? I think what you're saying
> is you want to stop old-style SQL functions from using temp tables
> that exist outside of them?

No, that's not part of the proposal.  The one case in which we'd
complain (at an error level TBD) is if a temp table is used to
define an old-style function's argument or result type, eg

	create temp table mytable (id int, data text);

	create function get_mytable() returns setof mytable as ...

This is problematic because the function will go away when mytable
does, no matter how its body is expressed.  That's always been so,
at least since we invented dependencies.

			regards, tom lane