Re: Fix bug with accessing to temporary tables of other sessions
Daniil Davydov <3danissimo@gmail.com>
From: Daniil Davydov <3danissimo@gmail.com>
To: Soumya S Murali <soumyamurali.work@gmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>, Tom Lane <tgl@sss.pgh.pa.us>, Stepan Neretin <slpmcf@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-04-13T14:18:07Z
Lists: pgsql-hackers
Hi, On Mon, Apr 13, 2026 at 7:39 PM Soumya S Murali <soumyamurali.work@gmail.com> wrote: > > > I tested the v16 patch on a clean tree and verified the behavior > across multiple execution paths. Thanks! > Cross-session access is consistently > blocked; all attempts result in an error - "relation does not exist" Hm, our patch should give an error like "cannot access temporary relations of other sessions". If you see "relation does not exist" I guess you try to access other session's temp table only by its name. It will not work since postgres will search this name within the "pg_temp" schema of the current session. You should explicitly specify other session's temp schema name in order to access its temp tables. You can find examples in our new test. Please, let me know if I am wrong and the current patch actually allows "relation does not exist" error to occur. In this case, it should be fixed. -- Best regards, Daniil Davydov
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