Re: Add primary keys to system catalogs

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Peter Eisentraut" <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add primary keys to system catalogs
Date: 2021-01-29 06:25:03
Message-ID: 6483a0f8-5b4c-4528-ad83-485593529efb@www.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 22, 2021, at 16:42, Tom Lane wrote:
>"Joel Jacobson" <joel(at)compiler(dot)org> writes:
>> I ran this query (on a patched database) to see if there are still any catalog tables without primary keys:
>> ...
>> pg_depend
>> pg_shdepend
>
>Yeah, this is noted in the patch's own regression tests.

Thanks. Looks good.

>> Wouldn't it be possible to add primary keys to these two as well?
>
>Neither of the existing indexes is suitable, not being unique.
>
>We could imagine adding a unique index across the whole column set,
>but that would be an awfully large price to pay for neatnik-ism.
>Also, at least for pg_depend (less sure about pg_shdepend), some code
>cleanup would be required, because I don't think that we try very
>hard to avoid making duplicate dependency entries. On the whole
>I feel this'd be counterproductive.
>
>regards, tom lane

I see, and I agree with you.

I'm very happy with this patch.

I've already found great use of it in a tool I'm working on:
https://github.com/truthly/pg-pit/blob/master/FUNCTIONS/add_primary_keys.sql#L23

Many thanks to all of you for all the great work!
Can't wait to use this functionality in production.

/Joel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hou, Zhijie 2021-01-29 06:43:14 RE: Determine parallel-safety of partition relations for Inserts
Previous Message Fujii Masao 2021-01-29 06:24:40 Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit