pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add primary keys and unique constraints to system catalogs
Date: Sat, 30 Jan 2021 18:48:31 +0000
Message-ID: <E1l5vIN-00080v-Qa@gemulon.postgresql.org> (raw )
Add primary keys and unique constraints to system catalogs
For those system catalogs that have a unique indexes, make a primary
key and unique constraint, using ALTER TABLE ... PRIMARY KEY/UNIQUE
USING INDEX.
This can be helpful for GUI tools that look for a primary key, and it
might in the future allow declaring foreign keys, for making schema
diagrams.
The constraint creation statements are automatically created by
genbki.pl from DECLARE_UNIQUE_INDEX directives. To specify which one
of the available unique indexes is the primary key, use the new
directive DECLARE_UNIQUE_INDEX_PKEY instead. By convention, we
usually make a catalog's OID column its primary key, if it has one.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/dc5f44d9-5ec1-a596-0251-dadadcdede98@2ndquadrant.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/dfb75e478cacb33d277432e0df5e2f9a2a2b52d9
Modified Files
--------------
src/backend/catalog/.gitignore | 1 +
src/backend/catalog/Catalog.pm | 11 ++--
src/backend/catalog/Makefile | 9 ++--
src/backend/catalog/genbki.pl | 23 +++++++++
src/bin/initdb/initdb.c | 60 +++++-----------------
src/include/catalog/genbki.h | 12 +++--
src/include/catalog/pg_aggregate.h | 2 +-
src/include/catalog/pg_am.h | 2 +-
src/include/catalog/pg_amop.h | 2 +-
src/include/catalog/pg_amproc.h | 2 +-
src/include/catalog/pg_attrdef.h | 2 +-
src/include/catalog/pg_attribute.h | 2 +-
src/include/catalog/pg_auth_members.h | 2 +-
src/include/catalog/pg_authid.h | 2 +-
src/include/catalog/pg_cast.h | 2 +-
src/include/catalog/pg_class.h | 2 +-
src/include/catalog/pg_collation.h | 2 +-
src/include/catalog/pg_constraint.h | 2 +-
src/include/catalog/pg_conversion.h | 2 +-
src/include/catalog/pg_database.h | 2 +-
src/include/catalog/pg_db_role_setting.h | 2 +-
src/include/catalog/pg_default_acl.h | 2 +-
src/include/catalog/pg_description.h | 2 +-
src/include/catalog/pg_enum.h | 2 +-
src/include/catalog/pg_event_trigger.h | 2 +-
src/include/catalog/pg_extension.h | 2 +-
src/include/catalog/pg_foreign_data_wrapper.h | 2 +-
src/include/catalog/pg_foreign_server.h | 2 +-
src/include/catalog/pg_foreign_table.h | 2 +-
src/include/catalog/pg_index.h | 2 +-
src/include/catalog/pg_inherits.h | 2 +-
src/include/catalog/pg_init_privs.h | 2 +-
src/include/catalog/pg_language.h | 2 +-
src/include/catalog/pg_largeobject.h | 2 +-
src/include/catalog/pg_largeobject_metadata.h | 2 +-
src/include/catalog/pg_namespace.h | 2 +-
src/include/catalog/pg_opclass.h | 2 +-
src/include/catalog/pg_operator.h | 2 +-
src/include/catalog/pg_opfamily.h | 2 +-
src/include/catalog/pg_partitioned_table.h | 2 +-
src/include/catalog/pg_policy.h | 2 +-
src/include/catalog/pg_proc.h | 2 +-
src/include/catalog/pg_publication.h | 2 +-
src/include/catalog/pg_publication_rel.h | 2 +-
src/include/catalog/pg_range.h | 2 +-
src/include/catalog/pg_replication_origin.h | 2 +-
src/include/catalog/pg_rewrite.h | 2 +-
src/include/catalog/pg_seclabel.h | 2 +-
src/include/catalog/pg_sequence.h | 2 +-
src/include/catalog/pg_shdescription.h | 2 +-
src/include/catalog/pg_shseclabel.h | 2 +-
src/include/catalog/pg_statistic.h | 2 +-
src/include/catalog/pg_statistic_ext.h | 2 +-
src/include/catalog/pg_statistic_ext_data.h | 2 +-
src/include/catalog/pg_subscription.h | 2 +-
src/include/catalog/pg_subscription_rel.h | 2 +-
src/include/catalog/pg_tablespace.h | 2 +-
src/include/catalog/pg_transform.h | 2 +-
src/include/catalog/pg_trigger.h | 2 +-
src/include/catalog/pg_ts_config.h | 2 +-
src/include/catalog/pg_ts_config_map.h | 2 +-
src/include/catalog/pg_ts_dict.h | 2 +-
src/include/catalog/pg_ts_parser.h | 2 +-
src/include/catalog/pg_ts_template.h | 2 +-
src/include/catalog/pg_type.h | 2 +-
src/include/catalog/pg_user_mapping.h | 2 +-
.../unsafe_tests/expected/alter_system_table.out | 6 +--
.../unsafe_tests/sql/alter_system_table.sql | 5 +-
src/test/regress/expected/misc_sanity.out | 31 ++++++++++-
src/test/regress/sql/misc_sanity.sql | 24 +++++++++
src/tools/msvc/clean.bat | 1 +
71 files changed, 177 insertions(+), 126 deletions(-)
Message-ID: <E1l5vIN-00080v-Qa@gemulon.postgresql.org>
Permalink: ../E1l5vIN-00080v-Qa@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1l5vIN-00080v-Qa@gemulon.postgresql.org
copy link · copy postgr.es
reply 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-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: Add primary keys and unique constraints to system catalogs
In-Reply-To: <E1l5vIN-00080v-Qa@gemulon.postgresql.org>
References: <E1l5vIN-00080v-Qa@gemulon.postgresql.org>
* 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