summaryrefslogtreecommitdiff
path: root/src/include/catalog/pg_class.h
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2021-01-30 19:14:31 +0100
committerPeter Eisentraut <peter@eisentraut.org>2021-01-30 19:44:29 +0100
commitdfb75e478cacb33d277432e0df5e2f9a2a2b52d9 (patch)
treef22b9b6f1d6b5238ba2cfb23560a843d81f12821 /src/include/catalog/pg_class.h
parent65330622441d7ee08f768c4326825ae903f2595a (diff)
downloadpostgresql-dfb75e478cacb33d277432e0df5e2f9a2a2b52d9.tar.gz
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
Diffstat (limited to 'src/include/catalog/pg_class.h')
-rw-r--r--src/include/catalog/pg_class.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h
index e8dcd15a55..eca306ca98 100644
--- a/src/include/catalog/pg_class.h
+++ b/src/include/catalog/pg_class.h
@@ -152,7 +152,7 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat
*/
typedef FormData_pg_class *Form_pg_class;
-DECLARE_UNIQUE_INDEX(pg_class_oid_index, 2662, on pg_class using btree(oid oid_ops));
+DECLARE_UNIQUE_INDEX_PKEY(pg_class_oid_index, 2662, on pg_class using btree(oid oid_ops));
#define ClassOidIndexId 2662
DECLARE_UNIQUE_INDEX(pg_class_relname_nsp_index, 2663, on pg_class using btree(relname name_ops, relnamespace oid_ops));
#define ClassNameNspIndexId 2663