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: Michael Paquier <michael@paquier.xyz>,
Alexander Korotkov <aekorotkov@gmail.com>
Cc: 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-24T22:09:39Z
Lists: pgsql-hackers
Hi Michael, Thanks for the review. On 22/04/2026 01:41, Michael Paquier wrote: > As a whole, we were not really convinced that this is something that > needs any kind of specific fix, especially not something that should > be backpatched. This surprises me a little bit. Until now I was under the impression that fixing it was the consensus here. Just the "how" was being discussed. > After saying all that, there is some value in what you are doing here: > it is true that we lack test coverage in terms of interactions of > temporary objects across multiple sessions, and that we should have > some. TAP is adapted for this purpose, isolation tests could be an > extra one but the schema names make that unpredictible in output. The > patch unfortunately does a poor job in showing what it wants to > change. One thing that I would suggest is to *reverse* the order of > the patches: > - First have a patch that introduces new tests, that shows the > original behavior. This needs to be more complete in terms of command > patterns. The DROP TABLE is one case that we want to keep. This > should be kept as-is, and it is critical to document the reason why we > want to keep things this way (aka autovacuum and orphaned tables, > AFAIK). > - Then implement the second patch that updates the tests introduced in > the first patch, so as one can track *what* has changed, and so as one > does not have to test manually what the original behavior was. Fair point on tests comments and coverage. But before we start with the refactoring, I'd like to make sure I understood your suggestion correctly. You're suggesting: 0001 - TAP tests with improved coverage and comments that pass on current master, documenting the existing behaviour, which means broken commands silently succeed (e.g. SELECT returns 0 rows, no error) 0002 - read_stream.c and bufmgr.c fix + updated test expectations (the same commands now raise errors) Is it what you had in mind? 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