Re: foreign_key test is sensitive to the OID counter

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: foreign_key test is sensitive to the OID counter
Date: 2026-09-01 14:48:39
Message-ID: 1180793.1788274119@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Richard Guo <guofenglinux(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-09-01 14:58:44 Fix -Wshadow=local warnings
Previous Message Aleksander Alekseev 2026-09-01 14:32:26 [PATCH] Remove dead code in pg_dump