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

Поиск
Список
Период
Сортировка
От Jim Jones
Тема Re: Add notification on BEGIN ATOMIC SQL functions using temp relations
Дата
Msg-id 07aeb2b4-5fc2-41b6-a161-922d91d039a2@uni-muenster.de
обсуждение исходный текст
Ответ на Re: Add notification on BEGIN ATOMIC SQL functions using temp relations  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Add notification on BEGIN ATOMIC SQL functions using temp relations
Список pgsql-hackers
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?

postgres=# CREATE TEMPORARY TABLE tmp AS SELECT 42 AS val;
SELECT 1

postgres=# CREATE FUNCTION tmpval_atomic()
RETURNS int LANGUAGE sql
BEGIN ATOMIC;
SELECT val FROM tmp;
END;
WARNING:  function defined with BEGIN ATOMIC depends on temporary
relation "tmp"
DETAIL:  the function will be dropped automatically at session end.
CREATE FUNCTION

postgres=# SELECT tmpval_atomic();
 tmpval_atomic
---------------
            42
(1 row)

Best regards, Jim



В списке pgsql-hackers по дате отправления: