Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x1Pn4-005BBc-0S for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Sep 2026 14:48:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x1Pn3-006i03-0K for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Sep 2026 14:48:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x1Pn2-006hzu-2b for pgsql-hackers@lists.postgresql.org; Tue, 01 Sep 2026 14:48:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x1Pn0-00000003U1l-1PtU for pgsql-hackers@lists.postgresql.org; Tue, 01 Sep 2026 14:48:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 681EmdDI1180794; Tue, 1 Sep 2026 10:48:39 -0400 From: Tom Lane To: Richard Guo cc: Pg Hackers Subject: Re: foreign_key test is sensitive to the OID counter In-reply-to: References: Comments: In-reply-to Richard Guo message dated "Tue, 01 Sep 2026 17:32:10 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1180792.1788274119.1@sss.pgh.pa.us> Date: Tue, 01 Sep 2026 10:48:39 -0400 Message-ID: <1180793.1788274119@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo 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