Re: TupleDescAttr bounds checks
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Alexander Lakhin <exclusion@gmail.com>,
Robert Haas <robertmhaas@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-05T03:45:27Z
Lists: pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes: > On 04.04.26 17:38, Tom Lane wrote: >> After poking at that: testing tableoid does sort of work, in that it >> reads as the OID of the target table named in COPY. But I think any >> rational use for a test on tableoid here would be in connection with >> a partitioned target table, and the user would wish it to read as the >> OID of the destination partition. So I think we should disallow >> tableoid along with the other system columns, pending somebody having >> the ambition to make that work. > I think this is the same issue that was discussed here: > https://www.postgresql.org/message-id/flat/30c39ee8-bb11-4b8f-9697-45f7e018a8d3%40eisentraut.org > There was no conclusion there, but I agree with the proposal to prohibit > this use. Ah, indeed. Jian's patch in that thread seems rough but potentially workable to me, but seemingly the thread tailed off for lack of interest. I don't want to revive it now as part of a bug fix. Disallowing tableoid for now, and then re-allowing it if someone picks up that patch down the road, seems like a good solution. For one thing, since that patch changes the semantics of tableoid in COPY WHERE, I think it'd be a good idea to have a release or two in between where we throw error. That'd be helpful to flush out any field usages that might be affected. regards, tom lane
Commits
-
Avoid unsafe access to negative index in a TupleDesc.
- 681a91d29d4d 17.10 landed
- 40fa04e7c851 14.23 landed
- 3c7a6bbe63e2 16.14 landed
- 11c2c0cc8d7c 18.4 landed
- 07e833e3cff3 15.18 landed
-
Disallow system columns in COPY FROM WHERE conditions.
- 21c69dc73f9d 19 (unreleased) landed
-
Add a test for creating an index on a whole-row expression.
- 4647ee2da37c 19 (unreleased) landed
-
Bounds-check access to TupleDescAttr with an Assert.
- c98ad086ad9b 19 (unreleased) landed
-
Prevent spurious "indexes on virtual generated columns are not supported".
- 570e2fcc041a 19 (unreleased) landed
- cceb9c18a50b 18.4 landed