From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: foreign_key test is sensitive to the OID counter
Date: Tue, 01 Sep 2026 10:48:39 -0400
Message-ID: <1180793.1788274119@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMbWs49KaJFGs4rfBWk+YmHPTXZ+pJTMJ12iaz7ruZdSK+sC5w@mail.gmail.com>
References: <CAMbWs49KaJFGs4rfBWk+YmHPTXZ+pJTMJ12iaz7ruZdSK+sC5w@mail.gmail.com>
Richard Guo <guofenglinux@gmail.com> writes:
> These OIDs are constraint OIDs, not relation OIDs, so the regclass
> cast just renders them as numeric strings, and comparing those as text
> depends on the number of digits. Once the OID counter crosses a power
> of ten while the test runs, '1000006' sorts before '999987' and the
> output order flips.
Right, that's bogus.
> I plan to push the attached patch to fix it. Any thoughts?
This is only somewhat less bogus, though: it'd still fail at OID
wraparound. How about sorting by the constraint name?
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, guofenglinux@gmail.com
Subject: Re: foreign_key test is sensitive to the OID counter
In-Reply-To: <1180793.1788274119@sss.pgh.pa.us>
References: <CAMbWs49KaJFGs4rfBWk+YmHPTXZ+pJTMJ12iaz7ruZdSK+sC5w@mail.gmail.com> <1180793.1788274119@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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