Re: Fix bug with accessing to temporary tables of other sessions
Jim Jones <jim.jones@uni-muenster.de>
From: Jim Jones <jim.jones@uni-muenster.de>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
Alexander Korotkov <aekorotkov@gmail.com>,
Soumya S Murali <soumyamurali.work@gmail.com>,
Daniil Davydov <3danissimo@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>,
Stepan Neretin <slpmcf@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Mohamed Ali <moali.pg@gmail.com>, Nazneen Jafri <jafrinazneen@gmail.com>,
Shawn McCoy <shawn.the.mccoy@gmail.com>
Date: 2026-04-24T23:01:21Z
Lists: pgsql-hackers
Hi David
On 25/04/2026 00:30, David G. Johnston wrote:
> If you can run the tests against v17 (that is the behavior we are trying
> to restore here, correct?) and v18 that would help demonstrate why the
> backpatch is needed.
Tests for PG18 and PG17:
== PG 18 ==
psql (18.3 (Debian 18.3-1.pgdg13+1))
Type "help" for help.
postgres=# \d pg_temp*.*
Table "pg_temp_36.t"
Column | Type | Collation | Nullable | Default
-----------------+---------+-----------+----------+---------
generate_series | integer | | |
postgres=# SELECT * FROM pg_temp_36.t;
generate_series
-----------------
(0 rows)
== PG 17 ==
psql (17.7 (Debian 17.7-3.pgdg13+1))
Geben Sie »help« für Hilfe ein.
postgres=# \d pg_temp*.*
Tabelle »pg_temp_13.t«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
-----------------+---------+--------------+---------------+-------------
generate_series | integer | | |
postgres=# SELECT * FROM pg_temp_13.t;
generate_series
-----------------
(0 Zeilen)
Until PG16 an error message was raised:
psql (16.13 (Debian 16.13-1.pgdg13+1))
Type "help" for help.
postgres=# \d pg_temp*.*
Table "pg_temp_3.t"
Column | Type | Collation | Nullable | Default
-----------------+---------+-----------+----------+---------
generate_series | integer | | |
postgres=# SELECT * FROM pg_temp_3.t;
ERROR: cannot access temporary tables of other sessions
Best, Jim
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Prevent access to other sessions' temp tables
- 4dfae59a1d31 17 (unreleased) landed
- 1b0dd08157bf 18 (unreleased) landed
- ce146621f786 19 (unreleased) landed
-
Add tests for cross-session temp table access
- 40927d458fe1 17 (unreleased) landed
- 1cd37a7a8dc6 18 (unreleased) landed
- 1fee0e857e33 19 (unreleased) landed
-
Doc: use "an SQL" consistently rather than "a SQL"
- b51f86e49a7f 18.0 cited
-
Modify the relcache to record the temp status of both local and nonlocal
- 948d6ec90fd3 8.4.0 cited