agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Fix OID-counter-sensitive row ordering in foreign_key test 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix OID-counter-sensitive row ordering in foreign_key test @ 2026-09-02 05:05 Richard Guo <rguo@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Richard Guo @ 2026-09-02 05:05 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix OID-counter-sensitive row ordering in foreign_key test Several queries in the foreign_key test sort pg_constraint rows with "ORDER BY oid::regclass::text". These OIDs are constraint OIDs, not relation OIDs, so the regclass cast renders them as numeric strings, and text comparison of numeric strings depends on digit count. If the OID counter crosses a power of ten while the test runs, the output order flips, causing spurious test failures. This cannot happen in a fresh cluster, but installcheck against a long-lived cluster can hit it. To fix, sort by constraint name, which is unique within each of these queries, and use COLLATE "C" so that the order does not depend on the database's default collation either. Author: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: jian he <jian.universality@gmail.com> Discussion: https://postgr.es/m/CAMbWs49KaJFGs4rfBWk+YmHPTXZ+pJTMJ12iaz7ruZdSK+sC5w@mail.gmail.com Backpatch-through: 18 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f23de8dcba906ba27250f5f878e0684795eaf853 Modified Files -------------- src/test/regress/expected/foreign_key.out | 36 +++++++++++++++---------------- src/test/regress/sql/foreign_key.sql | 18 ++++++++-------- 2 files changed, 27 insertions(+), 27 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix OID-counter-sensitive row ordering in foreign_key test @ 2026-09-02 05:05 Richard Guo <rguo@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Richard Guo @ 2026-09-02 05:05 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix OID-counter-sensitive row ordering in foreign_key test Several queries in the foreign_key test sort pg_constraint rows with "ORDER BY oid::regclass::text". These OIDs are constraint OIDs, not relation OIDs, so the regclass cast renders them as numeric strings, and text comparison of numeric strings depends on digit count. If the OID counter crosses a power of ten while the test runs, the output order flips, causing spurious test failures. This cannot happen in a fresh cluster, but installcheck against a long-lived cluster can hit it. To fix, sort by constraint name, which is unique within each of these queries, and use COLLATE "C" so that the order does not depend on the database's default collation either. Author: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: jian he <jian.universality@gmail.com> Discussion: https://postgr.es/m/CAMbWs49KaJFGs4rfBWk+YmHPTXZ+pJTMJ12iaz7ruZdSK+sC5w@mail.gmail.com Backpatch-through: 18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6544d0a39d9c0c0e89dbcf38eb4bfb9201923816 Modified Files -------------- src/test/regress/expected/foreign_key.out | 36 +++++++++++++++---------------- src/test/regress/sql/foreign_key.sql | 18 ++++++++-------- 2 files changed, 27 insertions(+), 27 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix OID-counter-sensitive row ordering in foreign_key test @ 2026-09-02 05:05 Richard Guo <rguo@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Richard Guo @ 2026-09-02 05:05 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix OID-counter-sensitive row ordering in foreign_key test Several queries in the foreign_key test sort pg_constraint rows with "ORDER BY oid::regclass::text". These OIDs are constraint OIDs, not relation OIDs, so the regclass cast renders them as numeric strings, and text comparison of numeric strings depends on digit count. If the OID counter crosses a power of ten while the test runs, the output order flips, causing spurious test failures. This cannot happen in a fresh cluster, but installcheck against a long-lived cluster can hit it. To fix, sort by constraint name, which is unique within each of these queries, and use COLLATE "C" so that the order does not depend on the database's default collation either. Author: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: jian he <jian.universality@gmail.com> Discussion: https://postgr.es/m/CAMbWs49KaJFGs4rfBWk+YmHPTXZ+pJTMJ12iaz7ruZdSK+sC5w@mail.gmail.com Backpatch-through: 18 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/262f2eea958d21fdbe90a3e92ccc3e5c3f0d8059 Modified Files -------------- src/test/regress/expected/foreign_key.out | 36 +++++++++++++++---------------- src/test/regress/sql/foreign_key.sql | 18 ++++++++-------- 2 files changed, 27 insertions(+), 27 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-09-02 05:05 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-02 05:05 pgsql: Fix OID-counter-sensitive row ordering in foreign_key test Richard Guo <rguo@postgresql.org> 2026-09-02 05:05 pgsql: Fix OID-counter-sensitive row ordering in foreign_key test Richard Guo <rguo@postgresql.org> 2026-09-02 05:05 pgsql: Fix OID-counter-sensitive row ordering in foreign_key test Richard Guo <rguo@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox