Add notification on BEGIN ATOMIC SQL functions using temp relations - Mailing list pgsql-hackers

From David G. Johnston
Subject Add notification on BEGIN ATOMIC SQL functions using temp relations
Date
Msg-id CAKFQuwa_Q47_iEonqR7+P-5BB+YVN5daQ0vo1N2p+9TUXvw0Hw@mail.gmail.com
Whole thread Raw
In response to Re: Add notification on BEGIN ATOMIC SQL functions using temp relations  (Jim Jones <jim.jones@uni-muenster.de>)
Responses Re: Add notification on BEGIN ATOMIC SQL functions using temp relations
List pgsql-hackers
On Sunday, September 21, 2025, Jim Jones <jim.jones@uni-muenster.de> wrote:
Hi Pavel

On 9/21/25 14:33, Pavel Stehule wrote:
> i understand your motivation, but with this warning temp tables cannot
> be used in SQL function due log overhead.

My intention was not to warn on every function call. The WARNING is only
emitted once at CREATE FUNCTION time, similar to how CREATE VIEW warns
if a view depends on a temporary relation. After creation, the function
can still be used normally without additional log overhead. Is there a
side effect I might be overlooking here?

I’m surprised that this is how the system works and I agree that either we should add this notice or remove the one for create view.  Even more because there is no syntax for directly creating a temporary function - this is basically executing drop…cascade on the temporary relation.  Which then leads me to wonder whether selecting from a temporary view is is detected here.

One argument for leaving the status quote, which is a decent one, is that one can prevent the create view from emitting the notice via adding temporary to the SQL command - there is no such ability for create function.

If added this should be a notice, not a warning, so least min messages can be used to ignore it reasonably.

I’d rather we take this one step further and add “temp” to “create function” and make this behave exactly identical to “create [temp] view” than put in this half-measure where you get a notice without any way to suppress it specifically.

David J.

pgsql-hackers by date:

Previous
From: Jim Jones
Date:
Subject: Re: Add notification on BEGIN ATOMIC SQL functions using temp relations
Next
From: Vik Fearing
Date:
Subject: Re: Add notification on BEGIN ATOMIC SQL functions using temp relations