Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1xV9-0003nC-Kt for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Jan 2021 20:21:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l1xV8-0008S0-3O for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Jan 2021 20:21:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1xV7-0008Rt-SO for pgsql-hackers@lists.postgresql.org; Tue, 19 Jan 2021 20:21:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1xV1-000154-L9 for pgsql-hackers@postgresql.org; Tue, 19 Jan 2021 20:21:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 10JKL3LY521109; Tue, 19 Jan 2021 15:21:03 -0500 From: Tom Lane To: Laurenz Albe cc: Peter Eisentraut , pgsql-hackers Subject: Re: Add primary keys to system catalogs In-reply-to: References: <348f3158-bf7e-c5f0-f33b-9e552e3d5481@2ndquadrant.com> <266949.1610921277@sss.pgh.pa.us> Comments: In-reply-to Laurenz Albe message dated "Tue, 19 Jan 2021 11:46:55 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <521107.1611087663.1@sss.pgh.pa.us> Date: Tue, 19 Jan 2021 15:21:03 -0500 Message-ID: <521108.1611087663@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Laurenz Albe 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