pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joel Jacobson <joel@compiler.org>
Cc: pgsql-hackers@lists.postgresql.org, "Peter Eisentraut" <peter.eisentraut@enterprisedb.com>
Subject: Re: Recording foreign key relationships for the system catalogs
Date: Tue, 02 Feb 2021 11:00:48 -0500
Message-ID: <3716490.1612281648@sss.pgh.pa.us> (raw)
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>

"Joel Jacobson" <joel@compiler.org> 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





view thread (14+ messages)  latest in thread

Message-ID: <3716490.1612281648@sss.pgh.pa.us>
Permalink:  ../3716490.1612281648@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3716490.1612281648@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, joel@compiler.org, peter.eisentraut@enterprisedb.com
  Subject: Re: Recording foreign key relationships for the system catalogs
  In-Reply-To: <3716490.1612281648@sss.pgh.pa.us>
  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> <3716490.1612281648@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox