Re: Forbid to DROP temp tables of other sessions

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Daniil Davydov <3danissimo@gmail.com>
Cc: Steven Niu <niushiji@gmail.com>, "Andrey M. Borodin" <x4mmm@yandex-team.ru>, Andres Freund <andres@anarazel.de>, Thomas Munro <thomas.munro@gmail.com>, Rafia Sabih <rafia.pghackers@gmail.com>, Michael Paquier <michael@paquier.xyz>, Tom Lane <tgl@sss.pgh.pa.us>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2025-03-17T19:36:04Z
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. pg_basebackup: Add missing PQclear in error path

On Mon, Mar 17, 2025 at 10:58 AM Daniil Davydov <3danissimo@gmail.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.