mirror of
https://github.com/postgres/postgres.git
synced 2025-06-23 14:01:44 +03:00
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.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user