Re: foreign_key test is sensitive to the OID counter

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: foreign_key test is sensitive to the OID counter
Date: 2026-09-01 09:04:34
Message-ID: CACJufxE9w13q22pco5kiC4xatr+TdZohegBZRjSHZCV9j_LrNA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 1, 2026 at 4:32 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
> I plan to push the attached patch to fix it. Any thoughts?
>

SELECT conname, convalidated, conrelid::regclass FROM pg_constraint
-WHERE conrelid::regclass::text like 'fk_partitioned_fk%' ORDER BY
oid::regclass::text;
+WHERE conrelid::regclass::text like 'fk_partitioned_fk%' ORDER BY oid;

Perhaps what they wanted at the time was

WHERE conrelid::regclass::text like 'fk_partitioned_fk%' ORDER BY
conrelid::regclass::text;

in https://git.postgresql.org/cgit/postgresql.git/commit/?id=6beb38cfc9ddd4cd3d2eb5402981ebdd69a618b4
we use ``::regclass::text COLLATE "C"`` is stable the tests.

IMHO, Using
ORDER BY conrelid::regclass::text COLLATE "C"
is more future-proof.

--
jian
https://www.enterprisedb.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2026-09-01 09:07:25 Re: Introduce XID age based replication slot invalidation
Previous Message solai v 2026-09-01 09:02:29 Re: Adding a stored generated column without long-lived locks