From 7c6df91dda27accab3097390ef0d21d93028c7a1 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 12 Jul 2002 18:43:19 +0000 Subject: Second phase of committing Rod Taylor's pg_depend/pg_constraint patch. pg_relcheck is gone; CHECK, UNIQUE, PRIMARY KEY, and FOREIGN KEY constraints all have real live entries in pg_constraint. pg_depend exists, and RESTRICT/CASCADE options work on most kinds of DROP; however, pg_depend is not yet very well populated with dependencies. (Most of the ones that are present at this point just replace formerly hardwired associations, such as the implicit drop of a relation's pg_type entry when the relation is dropped.) Need to add more logic to create dependency entries, improve pg_dump to dump constraints in place of indexes and triggers, and add some regression tests. --- src/backend/commands/indexcmds.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/backend/commands/indexcmds.c') diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 1338f16bb59..5cf03bd11aa 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.76 2002/07/01 15:27:45 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.77 2002/07/12 18:43:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -18,6 +18,7 @@ #include "access/heapam.h" #include "catalog/catalog.h" #include "catalog/catname.h" +#include "catalog/dependency.h" #include "catalog/index.h" #include "catalog/namespace.h" #include "catalog/pg_opclass.h" @@ -68,6 +69,7 @@ DefineIndex(RangeVar *heapRelation, List *attributeList, bool unique, bool primary, + bool isconstraint, Expr *predicate, List *rangetable) { @@ -208,7 +210,7 @@ DefineIndex(RangeVar *heapRelation, index_create(relationId, indexRelationName, indexInfo, accessMethodId, classObjectId, - primary, allowSystemTableMods); + primary, isconstraint, allowSystemTableMods); /* * We update the relation's pg_class tuple even if it already has @@ -566,6 +568,7 @@ RemoveIndex(RangeVar *relation, DropBehavior behavior) { Oid indOid; HeapTuple tuple; + ObjectAddress object; indOid = RangeVarGetRelid(relation, false); tuple = SearchSysCache(RELOID, @@ -580,7 +583,11 @@ RemoveIndex(RangeVar *relation, DropBehavior behavior) ReleaseSysCache(tuple); - index_drop(indOid); + object.classId = RelOid_pg_class; + object.objectId = indOid; + object.objectSubId = 0; + + performDeletion(&object, behavior); } /* -- cgit v1.2.3