Re: Recording foreign key relationships for the system catalogs

Joel Jacobson <joel@compiler.org>

From: "Joel Jacobson" <joel@compiler.org>
To: "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org, "Peter Eisentraut" <peter.eisentraut@enterprisedb.com>
Date: 2021-02-02T20:05:01Z
Lists: pgsql-hackers
On Tue, Feb 2, 2021, at 17:00, Tom Lane wrote:
>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.

Thanks for explaining, I get it now.

>Appreciate the review!  Please confirm if you agree with above
>analysis.

Yes, I agree with the analysis.

/Joel

Commits

  1. Remove special BKI_LOOKUP magic for namespace and role OIDs.

  2. Retire findoidjoins.

  3. Build in some knowledge about foreign-key relationships in the catalogs.