mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +03:00
First phase of applying Rod Taylor's pg_depend patch. This just adds
RESTRICT/CASCADE syntax to the DROP commands that need it, and propagates the behavioral option through the parser to the routines that execute drops. Doesn't do anything useful yet, but I figured I'd commit these changes so I could get out of the parser area while working on the rest.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.75 2002/06/20 20:29:27 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.76 2002/07/01 15:27:45 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -560,14 +560,9 @@ GetDefaultOpClass(Oid attrType, Oid accessMethodId)
|
||||
/*
|
||||
* RemoveIndex
|
||||
* Deletes an index.
|
||||
*
|
||||
* Exceptions:
|
||||
* BadArg if name is invalid.
|
||||
* "ERROR" if index nonexistent.
|
||||
* ...
|
||||
*/
|
||||
void
|
||||
RemoveIndex(RangeVar *relation)
|
||||
RemoveIndex(RangeVar *relation, DropBehavior behavior)
|
||||
{
|
||||
Oid indOid;
|
||||
HeapTuple tuple;
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/operatorcmds.c,v 1.3 2002/04/27 03:45:01 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/operatorcmds.c,v 1.4 2002/07/01 15:27:46 tgl Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The "DefineFoo" routines take the parse tree and pick out the
|
||||
@ -209,18 +209,13 @@ DefineOperator(List *names, List *parameters)
|
||||
/*
|
||||
* RemoveOperator
|
||||
* Deletes an operator.
|
||||
*
|
||||
* Exceptions:
|
||||
* BadArg if name is invalid.
|
||||
* BadArg if type1 is invalid.
|
||||
* "ERROR" if operator nonexistent.
|
||||
* ...
|
||||
*/
|
||||
void
|
||||
RemoveOperator(List *operatorName, /* operator name */
|
||||
TypeName *typeName1, /* left argument type name */
|
||||
TypeName *typeName2) /* right argument type name */
|
||||
RemoveOperator(RemoveOperStmt *stmt)
|
||||
{
|
||||
List *operatorName = stmt->opname;
|
||||
TypeName *typeName1 = (TypeName *) lfirst(stmt->args);
|
||||
TypeName *typeName2 = (TypeName *) lsecond(stmt->args);
|
||||
Oid operOid;
|
||||
Relation relation;
|
||||
HeapTuple tup;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.17 2002/06/17 14:31:32 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.18 2002/07/01 15:27:46 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -36,7 +36,6 @@
|
||||
#include "optimizer/clauses.h"
|
||||
#include "optimizer/planmain.h"
|
||||
#include "optimizer/prep.h"
|
||||
#include "parser/parse.h"
|
||||
#include "parser/parse_coerce.h"
|
||||
#include "parser/parse_expr.h"
|
||||
#include "parser/parse_relation.h"
|
||||
@ -280,7 +279,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
|
||||
* themselves will be destroyed, too.
|
||||
*/
|
||||
void
|
||||
RemoveRelation(const RangeVar *relation)
|
||||
RemoveRelation(const RangeVar *relation, DropBehavior behavior)
|
||||
{
|
||||
Oid relOid;
|
||||
|
||||
@ -2336,7 +2335,7 @@ AlterTableAlterColumnFlags(Oid myrelid,
|
||||
void
|
||||
AlterTableDropColumn(Oid myrelid,
|
||||
bool inh, const char *colName,
|
||||
int behavior)
|
||||
DropBehavior behavior)
|
||||
{
|
||||
elog(ERROR, "ALTER TABLE / DROP COLUMN is not implemented");
|
||||
}
|
||||
@ -2669,7 +2668,7 @@ AlterTableAddConstraint(Oid myrelid,
|
||||
void
|
||||
AlterTableDropConstraint(Oid myrelid,
|
||||
bool inh, const char *constrName,
|
||||
int behavior)
|
||||
DropBehavior behavior)
|
||||
{
|
||||
Relation rel;
|
||||
int deleted;
|
||||
@ -2678,7 +2677,7 @@ AlterTableDropConstraint(Oid myrelid,
|
||||
* We don't support CASCADE yet - in fact, RESTRICT doesn't work to
|
||||
* the spec either!
|
||||
*/
|
||||
if (behavior == CASCADE)
|
||||
if (behavior == DROP_CASCADE)
|
||||
elog(ERROR, "ALTER TABLE / DROP CONSTRAINT does not support the CASCADE keyword");
|
||||
|
||||
/*
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.3 2002/05/03 00:32:16 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.4 2002/07/01 15:27:48 tgl Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The "DefineFoo" routines take the parse tree and pick out the
|
||||
@ -39,7 +39,6 @@
|
||||
#include "commands/comment.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "miscadmin.h"
|
||||
#include "parser/parse.h"
|
||||
#include "parser/parse_func.h"
|
||||
#include "parser/parse_type.h"
|
||||
#include "utils/acl.h"
|
||||
@ -268,7 +267,7 @@ DefineType(List *names, List *parameters)
|
||||
* only work on scalar types.
|
||||
*/
|
||||
void
|
||||
RemoveType(List *names)
|
||||
RemoveType(List *names, DropBehavior behavior)
|
||||
{
|
||||
TypeName *typename;
|
||||
Relation relation;
|
||||
@ -574,7 +573,7 @@ DefineDomain(CreateDomainStmt *stmt)
|
||||
* Removes a domain.
|
||||
*/
|
||||
void
|
||||
RemoveDomain(List *names, int behavior)
|
||||
RemoveDomain(List *names, DropBehavior behavior)
|
||||
{
|
||||
TypeName *typename;
|
||||
Relation relation;
|
||||
@ -583,7 +582,7 @@ RemoveDomain(List *names, int behavior)
|
||||
char typtype;
|
||||
|
||||
/* CASCADE unsupported */
|
||||
if (behavior == CASCADE)
|
||||
if (behavior == DROP_CASCADE)
|
||||
elog(ERROR, "DROP DOMAIN does not support the CASCADE keyword");
|
||||
|
||||
/* Make a TypeName so we can use standard type lookup machinery */
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: view.c,v 1.64 2002/06/20 20:29:27 momjian Exp $
|
||||
* $Id: view.c,v 1.65 2002/07/01 15:27:49 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -248,14 +248,13 @@ DefineView(const RangeVar *view, Query *viewParse)
|
||||
DefineViewRules(view, viewParse);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------
|
||||
/*
|
||||
* RemoveView
|
||||
*
|
||||
* Remove a view given its name
|
||||
*------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
RemoveView(const RangeVar *view)
|
||||
RemoveView(const RangeVar *view, DropBehavior behavior)
|
||||
{
|
||||
Oid viewOid;
|
||||
|
||||
|
Reference in New Issue
Block a user