Re: Add primary keys to system catalogs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add primary keys to system catalogs
Date: 2021-01-21 17:15:56
Message-ID: 906053.1611249356@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> writes:
> On 2021-01-17 23:07, Tom Lane wrote:
>> I've reviewed this patch. It looks pretty solid to me, with a couple
>> trivial nits as mentioned below, and one bigger thing that's perhaps
>> in the category of bikeshedding. Namely, do we really want to prefer
>> using the OID indexes as the primary keys?

> I chose this because the notional foreign keys point to the OID.
> If you design some basic business database with customer IDs, product
> IDs, etc., you'd also usually make the ID the primary key, even if you
> have, say, a unique constraint on the product name. But this is of
> course a matter of taste to some degree.

Fair enough. As I said upthread, I just wanted to be sure we'd considered
the alternative. I'm content to use the OIDs as pkeys, although I think
that decision should be explicitly recorded somewhere (cf attachment).

>> The contents of system_constraints.sql seem pretty randomly ordered,
>> and I bet the order isn't stable across machines.

> They follow the order in which the catalogs are processed byt genbki.pl.

Looking closer, I see the data structure is an array not a hash, so
I withdraw the concern about instability.

After reading the patch again, I have a couple more nits about comments,
which I'll just present as a proposed delta patch. Otherwise it's good.
I'll mark it RFC.

regards, tom lane

Attachment Content-Type Size
catalog-primary-keys-comments.patch text/x-diff 3.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-01-21 18:08:28 Re: Bug in error reporting for multi-line JSON
Previous Message Bharath Rupireddy 2021-01-21 16:51:30 Re: Identify missing publications from publisher while create/alter subscription.