Re: Add primary keys to system catalogs - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Add primary keys to system catalogs
Date
Msg-id 521108.1611087663@sss.pgh.pa.us
Whole thread Raw
In response to Re: Add primary keys to system catalogs  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-hackers
Laurenz Albe <laurenz.albe@cybertec.at> writes:
> On Sun, 2021-01-17 at 17:07 -0500, Tom Lane wrote:
>> [...] do we really want to prefer
>> using the OID indexes as the primary keys?  In most cases there's some
>> other index that seems to me to be what a user would think of as the
>> pkey, for example pg_class_relname_nsp_index for pg_class or
>> pg_proc_proname_args_nsp_index for pg_proc.  Preferring OID where it
>> exists is a nice simple rule, which has some attractiveness, but the
>> OID indexes seem to me like a lookup aid rather than the "real" object
>> identity.

> I disagree.  The OID is the real, immutable identity of an object.
> The "relname" of a "pg_class" encatalogtry can change any time.
> Since there are no foreign keys that reference catalogs, that won't cause
> problems, but I still think that primary keys should change as little as
> possible.

Yeah, there's also the point that the OID is what we use for "foreign
key" references from other catalogs.  I don't deny that there are
reasons to think of OID as the pkey.  But as long as these constraints
are basically cosmetic, it seemed to me that we should consider the
other approach.  I'm not dead set on that, just wanted to discuss it.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Change default of checkpoint_completion_target
Next
From: Daniel Gustafsson
Date:
Subject: Re: Support for NSS as a libpq TLS backend