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>, pgsql-hackers@lists.postgresql.org
Cc: "Peter Eisentraut" <peter.eisentraut@enterprisedb.com>
Date: 2021-02-01T13:41:11Z
Lists: pgsql-hackers
Could it be an idea to also add

   OUT can_be_zero boolean

to pg_get_catalog_foreign_keys()'s out parameters?

This information is useful to know if one should be doing an INNER JOIN or a LEFT JOIN on the foreign keys.

The information is mostly available in the documentation already,
but not quite accurate, which I've proposed a patch [1] to fix.

[1] https://www.postgresql.org/message-id/4ed9a372-7bf9-479a-926c-ae8e774717a8@www.fastmail.com

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.