summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-01-21 22:48:20 +0000
committerBruce Momjian <bruce@momjian.us>1999-01-21 22:48:20 +0000
commitc91dbcc5c7b64aecfc0a246d0f8f2d60145e6326 (patch)
tree302cd1a2f305a40d4cfa001d3e74b5db9cf9f68c /src/include
parent7311da9ec48d6ed918cdede7be3c67817107301b (diff)
downloadpostgresql-c91dbcc5c7b64aecfc0a246d0f8f2d60145e6326.tar.gz
The following patch finishes primary key support. Previously, when
a field was labelled as a primary key, the system automatically created a unique index on the field. This patch extends it so that the index has the indisprimary field set. You can pull a list of primary keys with the followiing select. SELECT pg_class.relname, pg_attribute.attname FROM pg_class, pg_attribute, pg_index WHERE pg_class.oid = pg_attribute.attrelid AND pg_class.oid = pg_index.indrelid AND pg_index.indkey[0] = pg_attribute.attnum AND pg_index.indisunique = 't'; There is nothing in this patch that modifies the template database to set the indisprimary attribute for system tables. Should they be changed or should we only be concerned with user tables? D'Arcy
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/index.h5
-rw-r--r--src/include/commands/defrem.h3
-rw-r--r--src/include/nodes/parsenodes.h3
3 files changed, 7 insertions, 4 deletions
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index d377832241..b08d72e7d1 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: index.h,v 1.13 1998/09/01 04:34:43 momjian Exp $
+ * $Id: index.h,v 1.14 1999/01/21 22:48:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,8 @@ extern void index_create(char *heapRelationName,
Datum *parameter,
Node *predicate,
bool islossy,
- bool unique);
+ bool unique,
+ bool primary);
extern void index_destroy(Oid indexId);
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index 37b287d9fa..f5867bd3fa 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: defrem.h,v 1.13 1998/09/01 04:35:30 momjian Exp $
+ * $Id: defrem.h,v 1.14 1999/01/21 22:48:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,6 +25,7 @@ extern void DefineIndex(char *heapRelationName,
List *attributeList,
List *parameterList,
bool unique,
+ bool primary,
Expr *predicate,
List *rangetable);
extern void ExtendIndex(char *indexRelationName,
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 0e6c8e5068..32fd65c69e 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.67 1999/01/21 16:08:55 vadim Exp $
+ * $Id: parsenodes.h,v 1.68 1999/01/21 22:48:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -333,6 +333,7 @@ typedef struct IndexStmt
* transformStmt() */
bool *lossy; /* is index lossy? */
bool unique; /* is index unique? */
+ bool primary; /* is index on primary key? */
} IndexStmt;
/* ----------------------