Re: BUG #18492: Adding a toasted column to a table with an inherited temp table fails with Assert
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2024-06-03T21:03:11Z
Lists: pgsql-bugs
Attachments
- disallow-alter-other-temp-table-v1.patch (text/x-diff) patch v1
Andres Freund <andres@anarazel.de> writes: > On 2024-06-03 13:50:22 -0400, Tom Lane wrote: >> I'm inclined to think that we should reject any ALTER TABLE on another >> session's temp table. > +1 The attached seems to do the trick. I initially thought of adding the check to CheckTableNotInUse, but that is problematic because it would keep us from cleaning out a temp schema that had belonged to some other backend. So I added YA wrapper routine. I've gone through all the other callers of CheckTableNotInUse, and they appear to have checks of RELATION_IS_OTHER_TEMP where necessary, so there don't seem to be any related holes. With a different factorization we could perhaps merge those other checks, but it would be more invasive and we'd not gain all that much. We could set up a test of this error path, but it'd require an isolation or TAP script, and I'm unconvinced that it's worth the trouble. The most likely breakage is for someone to forget to make this check in some new code path, and a test using existing features would not catch that. regards, tom lane
Commits
-
Reject modifying a temp table of another session with ALTER TABLE.
- b8efd756dfc7 12.20 landed
- 8397f161e47c 16.4 landed
- 7ed8ce8a469b 17.0 landed
- 7c4ac652e432 13.16 landed
- 3c71cb497b02 15.8 landed
- 2dad0f433db9 14.13 landed