pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Prevent spurious "indexes on virtual generated columns are not s 2+ messages / 1 participants [nested] [flat]
* pgsql: Prevent spurious "indexes on virtual generated columns are not s @ 2026-03-24 10:38 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2026-03-24 10:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent spurious "indexes on virtual generated columns are not supported". Both of the checks in DefineIndex() that can produce this error message have a guard against negative attribute numbers, but lack a guard to ensure that attno is non-zero. As a result, we can index off the beginning of the TupleDesc and read a garbage byte for attgenerated. If that byte happens to be 'v', we'll incorrectly produce the error mentioned above. The first call site is easy to hit: any attempt to create an expression index does so. The second one is not currently hit in the regression tests, but can be hit by something like CREATE INDEX ON some_table ((some_function(some_table))). Found by study of a test_plan_advice failure on buildfarm member skink, though this issue has nothing to do with test_plan_advice and seems to have only been revealed by happenstance. Backpatch-through: 18 Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: http://postgr.es/m/CA+TgmoacixUZVvi00hOjk_d9B4iYKswWP1gNqQ8Vfray-AcOCA@mail.gmail.com Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cceb9c18a50b3611537050b3f9bb4685072823b4 Modified Files -------------- src/backend/commands/indexcmds.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Prevent spurious "indexes on virtual generated columns are not s @ 2026-03-24 10:38 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2026-03-24 10:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent spurious "indexes on virtual generated columns are not supported". Both of the checks in DefineIndex() that can produce this error message have a guard against negative attribute numbers, but lack a guard to ensure that attno is non-zero. As a result, we can index off the beginning of the TupleDesc and read a garbage byte for attgenerated. If that byte happens to be 'v', we'll incorrectly produce the error mentioned above. The first call site is easy to hit: any attempt to create an expression index does so. The second one is not currently hit in the regression tests, but can be hit by something like CREATE INDEX ON some_table ((some_function(some_table))). Found by study of a test_plan_advice failure on buildfarm member skink, though this issue has nothing to do with test_plan_advice and seems to have only been revealed by happenstance. Backpatch-through: 18 Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: http://postgr.es/m/CA+TgmoacixUZVvi00hOjk_d9B4iYKswWP1gNqQ8Vfray-AcOCA@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/570e2fcc041a55ba8991a640cc3f3f0e122feac3 Modified Files -------------- src/backend/commands/indexcmds.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-03-24 10:38 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-03-24 10:38 pgsql: Prevent spurious "indexes on virtual generated columns are not s Robert Haas <rhaas@postgresql.org> 2026-03-24 10:38 pgsql: Prevent spurious "indexes on virtual generated columns are not s Robert Haas <rhaas@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox