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 1l6y6v-0002TP-LM for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Feb 2021 16:01:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l6y6t-000646-9r for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Feb 2021 16:00:59 +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 1l6y6t-00063z-3A for pgsql-hackers@lists.postgresql.org; Tue, 02 Feb 2021 16:00:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6y6m-0000RL-Oo for pgsql-hackers@lists.postgresql.org; Tue, 02 Feb 2021 16:00:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 112G0mVm3716491; Tue, 2 Feb 2021 11:00:48 -0500 From: Tom Lane To: "Joel Jacobson" cc: pgsql-hackers@lists.postgresql.org, "Peter Eisentraut" Subject: Re: Recording foreign key relationships for the system catalogs In-reply-to: <2f7b0a46-d086-421a-9f72-0c1af3aff3a7@www.fastmail.com> References: <3240355.1612129197@sss.pgh.pa.us> <194e26d5-41b1-4672-b97d-25eba67fb225@www.fastmail.com> <3683750.1612236462@sss.pgh.pa.us> <2f7b0a46-d086-421a-9f72-0c1af3aff3a7@www.fastmail.com> Comments: In-reply-to "Joel Jacobson" message dated "Tue, 02 Feb 2021 08:51:09 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3716489.1612281648.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 02 Feb 2021 11:00:48 -0500 Message-ID: <3716490.1612281648@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Joel Jacobson" writes: > I could only find one minor error, > found by running the regression-tests, > and then using the query below to compare "is_opt" > with my own "zero_values" in my tool > that derives its value from pg_catalog content. > ... > I therefore think is_opt should be changed to true for this row: > fktable | fkcols | pktable | pkcols = | is_array | is_opt > ---------------+---------------------+--------------+-------------------= +----------+-------- > pg_constraint | {confrelid,confkey} | pg_attribute | {attrelid,attnum} |= t | f No, I think it's correct as-is (and this is one reason that I chose to have two separate FK entries for cases like this). confrelid can be zero in rows that are not FK constraints. However, such a row must also have empty confkey. The above entry states that for each element of confkey, the pair (confrelid,confkey[i]) must be nonzero and have a match in pg_attribute. It creates no constraint if confkey is empty. > If this is fixed, I also agree this is ready to be committed. Appreciate the review! Please confirm if you agree with above analysis. regards, tom lane