aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/cluster.c
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/backend/commands/cluster.c
parent7311da9ec48d6ed918cdede7be3c67817107301b (diff)
downloadpostgresql-c91dbcc5c7b64aecfc0a246d0f8f2d60145e6326.tar.gz
postgresql-c91dbcc5c7b64aecfc0a246d0f8f2d60145e6326.zip
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/backend/commands/cluster.c')
-rw-r--r--src/backend/commands/cluster.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 9d9324e8ff5..a8103912063 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.34 1998/12/14 05:18:39 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.35 1999/01/21 22:48:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -321,7 +321,8 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
Old_pg_index_Form->indclass,
(uint16) 0, (Datum) NULL, NULL,
Old_pg_index_Form->indislossy,
- Old_pg_index_Form->indisunique);
+ Old_pg_index_Form->indisunique,
+ Old_pg_index_Form->indisprimary);
heap_close(OldIndex);
heap_close(NewHeap);