From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Add primary keys to system catalogs
Date: Tue, 06 Oct 2020 15:31:16 -0400
Message-ID: <1996232.1602012676@sss.pgh.pa.us> (raw)
In-Reply-To: <20201006183450.f4jn7vzwsokqwgi2@alap3.anarazel.de>
References: <dc5f44d9-5ec1-a596-0251-dadadcdede98@2ndquadrant.com>
<20201006183450.f4jn7vzwsokqwgi2@alap3.anarazel.de>
Andres Freund <andres@anarazel.de> writes:
> On 2020-10-03 08:40:31 +0200, Peter Eisentraut wrote:
>> Since we have ADD PRIMARY KEY USING INDEX, we can declare a primary key for
>> an existing index. So this doesn't have to affect the low-level early
>> bootstrapping. The attached patch adds those commands manually. Another
>> option might be to have the catalog generation Perl tooling create those
>> declarations automatically from some marker in the catalog files. That
>> would also allow declaring unique constraints for the unique indexes that
>> don't end up being the primary key.
> Hm. What prevents us from declaring the pkey during bootstrap? I don't
> at all like adding yet another place that needs manual editing when
> doing DDL changes.
We don't add new catalogs often, so the cost-benefit ratio of automating
this looks pretty poor. It's not like you'll be able to forget to do it,
given the proposed regression test check for catalogs without pkeys.
One thing I'm wondering about though is whether Peter's implementation
ends up with desirable pg_depend contents for the pkey constraints.
Probably we want them to just be pinned and not have any explicit
dependencies on the associated indexes, but I haven't thought hard
about it.
regards, tom lane
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, andres@anarazel.de, peter.eisentraut@2ndquadrant.com
Subject: Re: Add primary keys to system catalogs
In-Reply-To: <1996232.1602012676@sss.pgh.pa.us>
References: <dc5f44d9-5ec1-a596-0251-dadadcdede98@2ndquadrant.com> <20201006183450.f4jn7vzwsokqwgi2@alap3.anarazel.de> <1996232.1602012676@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