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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add notification on BEGIN ATOMIC SQL functions using temp relations
Date: 2025-09-21 15:07:50
Message-ID: CAFj8pRBGUXdwuLg4edqDWVe2NTRUcBctFk05YAZ4djR3YRbG=A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

ne 21. 9. 2025 v 16:59 odesílatel Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> napsal:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > 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 -
>
> It is possible to do
>
> CREATE FUNCTION pg_temp.foo() ...
>
> However, then it's not in your search path and you have to write
> "pg_temp.foo" to call it, so this is far from transparent.
>
> The fact that you can't call a temporary function without explicit
> schema qualification is a security decision that is very unlikely
> to get relaxed. But because of that, temp functions aren't really
> first-class objects, and so I wouldn't be in favor of inventing
> CREATE TEMP FUNCTION.
>
> There's a larger issue here though: a function such as Jim shows
> is a normal function, probably stored in the public schema, and
> by default other sessions will be able to call it. But it will
> certainly not work as desired for them, since they can't access
> the creating session's temp tables. It would likely bollix
> a concurrent pg_dump too. I wonder if we'd be better off to
> forbid creation of such a function altogether.
>

+1

Pavel

>
> regards, tom lane
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2025-09-21 15:37:06 Re: Add notification on BEGIN ATOMIC SQL functions using temp relations
Previous Message Tom Lane 2025-09-21 14:59:38 Re: Add notification on BEGIN ATOMIC SQL functions using temp relations