Re: Forbid to DROP temp tables of other sessions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Daniil Davydov <3danissimo(at)gmail(dot)com>
Cc: Steven Niu <niushiji(at)gmail(dot)com>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Andres Freund <andres(at)anarazel(dot)de>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Forbid to DROP temp tables of other sessions
Date: 2025-03-17 19:36:04
Message-ID: CAKFQuwZ-SPdwY1mCJp3XF+TdGqUNVN8FAatTu2npusXtoFf0uA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 17, 2025 at 10:58 AM Daniil Davydov <3danissimo(at)gmail(dot)com>
wrote:

> 2)

Is this really the implementation detail that we want to hide from the
> user? User can just run "select pg_my_temp_schema();" and see that
> there is no temp schema in the current session.
>

No ordinary user uses that function; it serves no everyday usage need.

Don't get me wrong - I can agree with that, but for now it seems odd to
> me...
> Steven Niu also mentioned this issue, but IMO we must give the most
> accurate description of the problem - tell "relation not found" only
> if we have temp namespace, but not specified relation in it.
>
>
"I want to give a better error message" is not a good enough reason to
change this long-standing behavior in a back-patchable bug fix.

IOW, you don't get to change:

postgres=# select * from pg_temp.temp_table;
ERROR: relation "pg_temp.temp_table" does not exist
LINE 1: select * from pg_temp.temp_table;

to

postgres=# select * from pg_temp.tmptable;
ERROR: pg_temp was specified but it contains no relations
LINE 1: select * from pg_temp.tmptable;

In a released branch; and I do not agree that it is an improvement worth
making in HEAD.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-03-17 20:00:53 Re: AIO v2.5
Previous Message Nathan Bossart 2025-03-17 19:34:34 Re: optimize file transfer in pg_upgrade