Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEaSp-0002Vc-G6 for pgsql-general@arkaria.postgresql.org; Thu, 21 Jul 2022 17:59:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oEaSo-0007zc-B6 for pgsql-general@arkaria.postgresql.org; Thu, 21 Jul 2022 17:59:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEaSo-0007xH-0n for pgsql-general@lists.postgresql.org; Thu, 21 Jul 2022 17:59:54 +0000 Received: from mout.kundenserver.de ([217.72.192.75]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEaSi-0002wA-Rh for pgsql-general@lists.postgresql.org; Thu, 21 Jul 2022 17:59:53 +0000 Received: from x280 ([84.189.156.9]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N8XHb-1nRrji1Bib-014SPU; Thu, 21 Jul 2022 19:59:43 +0200 From: Christian Barthel To: Adrian Klaver Cc: pgsql-general@lists.postgresql.org Subject: Re: FK Constraint sort order with pg_dump References: <87h73a4bu3.fsf@online.de> X-Gpg-Key: https://onfire.org/bch/pgp/pubkey.asc X-Archive: expiry=7 Date: Thu, 21 Jul 2022 19:59:42 +0200 In-Reply-To: (Adrian Klaver's message of "Thu, 21 Jul 2022 10:49:33 -0700") Message-ID: <87bkti4a9d.fsf@online.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:8Bv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: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thursday, July 21, 2022, Adrian Klaver wrote: > On 7/21/22 10:25, Christian Barthel wrote: >> Hello, The sorting order of FK constraints with the same name is >> based on the OID (because it lands in the =E2=80=9CUsually shouldn=E2=80= =99t get >> here=E2=80=9D OID comparison block at [1]). Wouldn=E2=80=99t it be bett= er if the >> order of those constraints were based on the table name? >>=20 > > Why does it matter? As the comment in pg_dump.c states, logically identical schemas should produce identical dumps: | * We rely on dependency information to help us determine a safe order, | so * the initial sort is mostly for cosmetic purposes: we sort by name | to * ensure that logically identical schemas will dump identically. This is done for most objects (tables, functions etc). Why not for FK constraints? It makes comparing schemas on different postgres instances simpler (i.e. when you=E2=80=99re working with testing, staging, live systems etc). --=20 Christian Barthel