Re: TupleDescAttr bounds checks

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-04T14:30:02Z
Lists: pgsql-hackers
Alexander Lakhin <exclusion@gmail.com> writes:
> I've found a way to trigger the Assert added in c98ad086a:
> CREATE TABLE t(i int);
> COPY t FROM stdin WHERE tableoid > 0;
> server closed the connection unexpectedly

Good catch.  I bet it's possible to trigger the Assert just above,
too, with a WHERE expression using "t.*".

			regards, tom lane



Commits

  1. Avoid unsafe access to negative index in a TupleDesc.

  2. Disallow system columns in COPY FROM WHERE conditions.

  3. Add a test for creating an index on a whole-row expression.

  4. Bounds-check access to TupleDescAttr with an Assert.

  5. Prevent spurious "indexes on virtual generated columns are not supported".