From 8aea27b0ba38ec12e70fd0217960d3c645f66c8a Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" Date: Fri, 4 Dec 2026 16:18:44 +0800 Subject: [PATCH v1] Use the catalog OID cutoff in the type_sanity check for unique text indexes The check for IsCatalogTextUniqueIndexOid() omissions uses FirstNormalObjectId (16384) as its cutoff. This includes unpinned indexes created during initdb. For example, if an extension installed during initdb creates a unique index with a text column, the check can report that index as missing from the hard-coded list. Use FirstUnpinnedObjectId (12000) as the cutoff, matching IsCatalogRelationOid() in the buffer-lock assertion. Reported-by: Alex Guo Author: Chao Li Reviewed-by: Discussion: https://postgr.es/m/ Backpatch-through: 18 --- src/test/regress/expected/type_sanity.out | 2 +- src/test/regress/sql/type_sanity.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/regress/expected/type_sanity.out b/src/test/regress/expected/type_sanity.out index 1d21d3eb446..09516134ee0 100644 --- a/src/test/regress/expected/type_sanity.out +++ b/src/test/regress/expected/type_sanity.out @@ -599,7 +599,7 @@ SELECT indexrelid::regclass FROM pg_index WHERE (is_catalog_text_unique_index_oid(indexrelid) <> (indisunique AND - indexrelid < 16384 AND + indexrelid < 12000 AND -- FirstUnpinnedObjectId, as in IsCatalogRelationOid() EXISTS (SELECT 1 FROM pg_attribute WHERE attrelid = indexrelid AND atttypid = 'text'::regtype))); indexrelid diff --git a/src/test/regress/sql/type_sanity.sql b/src/test/regress/sql/type_sanity.sql index 95d5b6e0915..4ddfada453b 100644 --- a/src/test/regress/sql/type_sanity.sql +++ b/src/test/regress/sql/type_sanity.sql @@ -441,7 +441,7 @@ SELECT indexrelid::regclass FROM pg_index WHERE (is_catalog_text_unique_index_oid(indexrelid) <> (indisunique AND - indexrelid < 16384 AND + indexrelid < 12000 AND -- FirstUnpinnedObjectId, as in IsCatalogRelationOid() EXISTS (SELECT 1 FROM pg_attribute WHERE attrelid = indexrelid AND atttypid = 'text'::regtype))); -- 2.50.1 (Apple Git-155)