Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit131f801

Browse files
committed
First phase of applying Rod Taylor's pg_depend patch. This just adds
RESTRICT/CASCADE syntax to the DROP commands that need it, and propagatesthe behavioral option through the parser to the routines that executedrops. Doesn't do anything useful yet, but I figured I'd commit thesechanges so I could get out of the parser area while working on the rest.
1 parenta3ec44a commit131f801

File tree

13 files changed

+111
-101
lines changed

13 files changed

+111
-101
lines changed

‎src/backend/commands/indexcmds.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.75 2002/06/20 20:29:27 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.76 2002/07/01 15:27:45 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -560,14 +560,9 @@ GetDefaultOpClass(Oid attrType, Oid accessMethodId)
560560
/*
561561
* RemoveIndex
562562
*Deletes an index.
563-
*
564-
* Exceptions:
565-
*BadArg if name is invalid.
566-
*"ERROR" if index nonexistent.
567-
*...
568563
*/
569564
void
570-
RemoveIndex(RangeVar*relation)
565+
RemoveIndex(RangeVar*relation,DropBehaviorbehavior)
571566
{
572567
OidindOid;
573568
HeapTupletuple;

‎src/backend/commands/operatorcmds.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/operatorcmds.c,v 1.3 2002/04/27 03:45:01 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/operatorcmds.c,v 1.4 2002/07/01 15:27:46 tgl Exp $
1313
*
1414
* DESCRIPTION
1515
* The "DefineFoo" routines take the parse tree and pick out the
@@ -209,18 +209,13 @@ DefineOperator(List *names, List *parameters)
209209
/*
210210
* RemoveOperator
211211
*Deletes an operator.
212-
*
213-
* Exceptions:
214-
*BadArg if name is invalid.
215-
*BadArg if type1 is invalid.
216-
*"ERROR" if operator nonexistent.
217-
*...
218212
*/
219213
void
220-
RemoveOperator(List*operatorName,/* operator name */
221-
TypeName*typeName1,/* left argument type name */
222-
TypeName*typeName2)/* right argument type name */
214+
RemoveOperator(RemoveOperStmt*stmt)
223215
{
216+
List*operatorName=stmt->opname;
217+
TypeName*typeName1= (TypeName*)lfirst(stmt->args);
218+
TypeName*typeName2= (TypeName*)lsecond(stmt->args);
224219
OidoperOid;
225220
Relationrelation;
226221
HeapTupletup;

‎src/backend/commands/tablecmds.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.17 2002/06/17 14:31:32 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.18 2002/07/01 15:27:46 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -36,7 +36,6 @@
3636
#include"optimizer/clauses.h"
3737
#include"optimizer/planmain.h"
3838
#include"optimizer/prep.h"
39-
#include"parser/parse.h"
4039
#include"parser/parse_coerce.h"
4140
#include"parser/parse_expr.h"
4241
#include"parser/parse_relation.h"
@@ -280,7 +279,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
280279
* themselves will be destroyed, too.
281280
*/
282281
void
283-
RemoveRelation(constRangeVar*relation)
282+
RemoveRelation(constRangeVar*relation,DropBehaviorbehavior)
284283
{
285284
OidrelOid;
286285

@@ -2336,7 +2335,7 @@ AlterTableAlterColumnFlags(Oid myrelid,
23362335
void
23372336
AlterTableDropColumn(Oidmyrelid,
23382337
boolinh,constchar*colName,
2339-
intbehavior)
2338+
DropBehaviorbehavior)
23402339
{
23412340
elog(ERROR,"ALTER TABLE / DROP COLUMN is not implemented");
23422341
}
@@ -2669,7 +2668,7 @@ AlterTableAddConstraint(Oid myrelid,
26692668
void
26702669
AlterTableDropConstraint(Oidmyrelid,
26712670
boolinh,constchar*constrName,
2672-
intbehavior)
2671+
DropBehaviorbehavior)
26732672
{
26742673
Relationrel;
26752674
intdeleted;
@@ -2678,7 +2677,7 @@ AlterTableDropConstraint(Oid myrelid,
26782677
* We don't support CASCADE yet - in fact, RESTRICT doesn't work to
26792678
* the spec either!
26802679
*/
2681-
if (behavior==CASCADE)
2680+
if (behavior==DROP_CASCADE)
26822681
elog(ERROR,"ALTER TABLE / DROP CONSTRAINT does not support the CASCADE keyword");
26832682

26842683
/*

‎src/backend/commands/typecmds.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.3 2002/05/03 00:32:16 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.4 2002/07/01 15:27:48 tgl Exp $
1212
*
1313
* DESCRIPTION
1414
* The "DefineFoo" routines take the parse tree and pick out the
@@ -39,7 +39,6 @@
3939
#include"commands/comment.h"
4040
#include"commands/defrem.h"
4141
#include"miscadmin.h"
42-
#include"parser/parse.h"
4342
#include"parser/parse_func.h"
4443
#include"parser/parse_type.h"
4544
#include"utils/acl.h"
@@ -268,7 +267,7 @@ DefineType(List *names, List *parameters)
268267
* only work on scalar types.
269268
*/
270269
void
271-
RemoveType(List*names)
270+
RemoveType(List*names,DropBehaviorbehavior)
272271
{
273272
TypeName*typename;
274273
Relationrelation;
@@ -574,7 +573,7 @@ DefineDomain(CreateDomainStmt *stmt)
574573
*Removes a domain.
575574
*/
576575
void
577-
RemoveDomain(List*names,intbehavior)
576+
RemoveDomain(List*names,DropBehaviorbehavior)
578577
{
579578
TypeName*typename;
580579
Relationrelation;
@@ -583,7 +582,7 @@ RemoveDomain(List *names, int behavior)
583582
chartyptype;
584583

585584
/* CASCADE unsupported */
586-
if (behavior==CASCADE)
585+
if (behavior==DROP_CASCADE)
587586
elog(ERROR,"DROP DOMAIN does not support the CASCADE keyword");
588587

589588
/* Make a TypeName so we can use standard type lookup machinery */

‎src/backend/commands/view.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
*$Id: view.c,v 1.64 2002/06/20 20:29:27 momjian Exp $
9+
*$Id: view.c,v 1.65 2002/07/01 15:27:49 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -248,14 +248,13 @@ DefineView(const RangeVar *view, Query *viewParse)
248248
DefineViewRules(view,viewParse);
249249
}
250250

251-
/*------------------------------------------------------------------
251+
/*
252252
* RemoveView
253253
*
254254
* Remove a view given its name
255-
*------------------------------------------------------------------
256255
*/
257256
void
258-
RemoveView(constRangeVar*view)
257+
RemoveView(constRangeVar*view,DropBehaviorbehavior)
259258
{
260259
OidviewOid;
261260

‎src/backend/nodes/copyfuncs.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Portions Copyright (c) 1994, Regents of the University of California
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.191 2002/06/20 20:29:29 momjian Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.192 2002/07/01 15:27:51 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -2115,6 +2115,7 @@ _copyRemoveAggrStmt(RemoveAggrStmt *from)
21152115

21162116
Node_Copy(from,newnode,aggname);
21172117
Node_Copy(from,newnode,aggtype);
2118+
newnode->behavior=from->behavior;
21182119

21192120
returnnewnode;
21202121
}
@@ -2126,6 +2127,7 @@ _copyRemoveFuncStmt(RemoveFuncStmt *from)
21262127

21272128
Node_Copy(from,newnode,funcname);
21282129
Node_Copy(from,newnode,args);
2130+
newnode->behavior=from->behavior;
21292131

21302132
returnnewnode;
21312133
}
@@ -2137,6 +2139,7 @@ _copyRemoveOperStmt(RemoveOperStmt *from)
21372139

21382140
Node_Copy(from,newnode,opname);
21392141
Node_Copy(from,newnode,args);
2142+
newnode->behavior=from->behavior;
21402143

21412144
returnnewnode;
21422145
}
@@ -2395,6 +2398,7 @@ _copyDropPropertyStmt(DropPropertyStmt *from)
23952398
if (from->property)
23962399
newnode->property=pstrdup(from->property);
23972400
newnode->removeType=from->removeType;
2401+
newnode->behavior=from->behavior;
23982402

23992403
returnnewnode;
24002404
}
@@ -2422,6 +2426,7 @@ _copyDropPLangStmt(DropPLangStmt *from)
24222426

24232427
if (from->plname)
24242428
newnode->plname=pstrdup(from->plname);
2429+
newnode->behavior=from->behavior;
24252430

24262431
returnnewnode;
24272432
}

‎src/backend/nodes/equalfuncs.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Portions Copyright (c) 1994, Regents of the University of California
2121
*
2222
* IDENTIFICATION
23-
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.138 2002/06/20 20:29:29 momjian Exp $
23+
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.139 2002/07/01 15:27:52 tgl Exp $
2424
*
2525
*-------------------------------------------------------------------------
2626
*/
@@ -942,6 +942,8 @@ _equalRemoveAggrStmt(RemoveAggrStmt *a, RemoveAggrStmt *b)
942942
return false;
943943
if (!equal(a->aggtype,b->aggtype))
944944
return false;
945+
if (a->behavior!=b->behavior)
946+
return false;
945947

946948
return true;
947949
}
@@ -953,6 +955,8 @@ _equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
953955
return false;
954956
if (!equal(a->args,b->args))
955957
return false;
958+
if (a->behavior!=b->behavior)
959+
return false;
956960

957961
return true;
958962
}
@@ -964,6 +968,8 @@ _equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b)
964968
return false;
965969
if (!equal(a->args,b->args))
966970
return false;
971+
if (a->behavior!=b->behavior)
972+
return false;
967973

968974
return true;
969975
}
@@ -1229,6 +1235,8 @@ _equalDropPropertyStmt(DropPropertyStmt *a, DropPropertyStmt *b)
12291235
return false;
12301236
if (a->removeType!=b->removeType)
12311237
return false;
1238+
if (a->behavior!=b->behavior)
1239+
return false;
12321240

12331241
return true;
12341242
}
@@ -1255,6 +1263,8 @@ _equalDropPLangStmt(DropPLangStmt *a, DropPLangStmt *b)
12551263
{
12561264
if (!equalstr(a->plname,b->plname))
12571265
return false;
1266+
if (a->behavior!=b->behavior)
1267+
return false;
12581268

12591269
return true;
12601270
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp