Re: TupleDescAttr bounds checks

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-23T03:54:41Z
Lists: pgsql-hackers
Oddly enough, "adder" just showed this same failure [1]:

@@ -66,11 +66,9 @@
 CREATE FUNCTION wrap_do_analyze(c INT) RETURNS INT IMMUTABLE LANGUAGE SQL
 	AS 'SELECT $1 FROM public.do_analyze()';
 CREATE INDEX ON vaccluster(wrap_do_analyze(i));
+ERROR:  indexes on virtual generated columns are not supported
 INSERT INTO vaccluster VALUES (1), (2);
 ANALYZE vaccluster;

and that's not in the test_plan_advice run at all, but pg_upgrade's
run of the core regression tests.  I wonder if we recently made some
seemingly-unrelated change that has increased the probability of
having a 'v' in the right byte.  Anyway, you should get this fix
pushed.

			regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=adder&dt=2026-03-23%2002%3A23%3A13



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".