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

From Peter Eisentraut
Subject Add primary keys to system catalogs
Date
Msg-id dc5f44d9-5ec1-a596-0251-dadadcdede98@2ndquadrant.com
Whole thread Raw
Responses Re: Add primary keys to system catalogs
Re: Add primary keys to system catalogs
Re: Add primary keys to system catalogs
Re: Add primary keys to system catalogs
List pgsql-hackers
I saw someone ask once for a schema diagram of the system catalogs. 
Things like that have occasionally been produced manually, but they are 
not regularly updated.  That made me wonder, why can't we add primary 
and foreign keys to system catalogs and then have existing tools produce 
such a schema diagram automatically?

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.

I'm not dealing here with how we might do foreign keys between system 
catalogs, but I think the idea would be to have some way to declare a 
foreign key "on paper" without any actual triggers.

Any thoughts on this direction?

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Jürgen Purtz
Date:
Subject: Re: [PATCH] Add section headings to index types doc
Next
From: Kuntal Ghosh
Date:
Subject: Re: Incorrect assumption in heap_prepare_freeze_tuple