From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Craig Ringer <craig.ringer@enterprisedb.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Joel Jacobson <joel@compiler.org>
Subject: Re: Add primary keys to system catalogs
Date: Mon, 18 Jan 2021 12:23:11 -0500
Message-ID: <343866.1610990591@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZuq+x_XQywP1Nr5sez7nx0w1Gv8O9wd0xiXLpRzMjJyg@mail.gmail.com>
References: <dc5f44d9-5ec1-a596-0251-dadadcdede98@2ndquadrant.com>
<CAGRY4nz8dbL1OAT9X+EB1c_q_ZxJsdB-dp8csSLqCEDb1o6=Eg@mail.gmail.com>
<CA+TgmoZuq+x_XQywP1Nr5sez7nx0w1Gv8O9wd0xiXLpRzMjJyg@mail.gmail.com>
Robert Haas <robertmhaas@gmail.com> writes:
> I don't have any complaint about labelling some of the unique indexes
> as primary keys, but I think installing foreign keys that don't really
> enforce anything may lead to confusion.
I'm not sure if I buy the "confusion" argument, but after thinking
about this more I realized that there's a stronger roadblock for
treating catalog interrelationships as SQL foreign keys. Namely,
that we always represent no-reference situations with a zero OID,
whereas it'd have to be NULL to look like a valid foreign-key case.
Changing to real NULLs in those columns would of course break a ton
of C code, so I don't think that's gonna happen.
We could overlay an FK onto OID columns that should never have zero
entries, but that would miss enough of the interesting cases that
I don't find it a very attractive proposal.
So I think we should finish up the project of making real SQL
constraints for the catalog indexes, but the idea of making FK
constraints too looks like it'll end in failure.
The reason I got interested in this right now is the nearby
discussion [1] about why findoidjoins misses some catalog
relationships and whether we should fix that and/or make its results
more readily accessible. I'd thought perhaps FK constraint entries
could supersede the need for that tool altogether, but now it seems
like not. I still like the idea of marking OID relationships in the
catalog headers though. Perhaps we should take Joel's suggestion
of a new system catalog more seriously, and have genbki.pl populate
such a catalog from info in the catalog header files.
regards, tom lane
[1] https://www.postgresql.org/message-id/flat/d1f413ff-0e50-413d-910c-bdd9ee9752c1%40www.fastmail.com
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, robertmhaas@gmail.com, craig.ringer@enterprisedb.com, peter.eisentraut@2ndquadrant.com, joel@compiler.org
Subject: Re: Add primary keys to system catalogs
In-Reply-To: <343866.1610990591@sss.pgh.pa.us>
References: <dc5f44d9-5ec1-a596-0251-dadadcdede98@2ndquadrant.com> <CAGRY4nz8dbL1OAT9X+EB1c_q_ZxJsdB-dp8csSLqCEDb1o6=Eg@mail.gmail.com> <CA+TgmoZuq+x_XQywP1Nr5sez7nx0w1Gv8O9wd0xiXLpRzMjJyg@mail.gmail.com> <343866.1610990591@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