agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Richard Guo <rguo@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix OID-counter-sensitive row ordering in foreign_key test
Date: Wed, 02 Sep 2026 05:05:43 +0000
Message-ID: <E1x1dAM-000000038Cb-3Agg@gemulon.postgresql.org> (raw)
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(-)
view thread (3+ messages) latest in thread
Message-ID: <E1x1dAM-000000038Cb-3Agg@gemulon.postgresql.org>
Permalink: ../E1x1dAM-000000038Cb-3Agg@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x1dAM-000000038Cb-3Agg@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: rguo@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix OID-counter-sensitive row ordering in foreign_key test
In-Reply-To: <E1x1dAM-000000038Cb-3Agg@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox