Commit 37d937ea authored by Tom Lane's avatar Tom Lane

Code review for ALTER INDEX patch.

parent 235caf4b
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.8 2004/06/25 21:55:53 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.9 2004/08/22 00:08:27 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -89,6 +89,7 @@ ExecRenameStmt(RenameStmt *stmt) ...@@ -89,6 +89,7 @@ ExecRenameStmt(RenameStmt *stmt)
break; break;
case OBJECT_TABLE: case OBJECT_TABLE:
case OBJECT_INDEX:
case OBJECT_COLUMN: case OBJECT_COLUMN:
case OBJECT_TRIGGER: case OBJECT_TRIGGER:
{ {
...@@ -101,6 +102,7 @@ ExecRenameStmt(RenameStmt *stmt) ...@@ -101,6 +102,7 @@ ExecRenameStmt(RenameStmt *stmt)
switch (stmt->renameType) switch (stmt->renameType)
{ {
case OBJECT_TABLE: case OBJECT_TABLE:
case OBJECT_INDEX:
{ {
/* /*
* RENAME TABLE requires that we (still) hold * RENAME TABLE requires that we (still) hold
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.289 2004/08/02 04:26:05 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.290 2004/08/22 00:08:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1626,6 +1626,7 @@ _copyAlterTableStmt(AlterTableStmt *from) ...@@ -1626,6 +1626,7 @@ _copyAlterTableStmt(AlterTableStmt *from)
COPY_NODE_FIELD(relation); COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(cmds); COPY_NODE_FIELD(cmds);
COPY_SCALAR_FIELD(relkind);
return newnode; return newnode;
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.228 2004/08/02 04:26:05 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.229 2004/08/22 00:08:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -727,6 +727,7 @@ _equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b) ...@@ -727,6 +727,7 @@ _equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
{ {
COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(relation);
COMPARE_NODE_FIELD(cmds); COMPARE_NODE_FIELD(cmds);
COMPARE_SCALAR_FIELD(relkind);
return true; return true;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.308 2004/08/02 04:26:29 tgl Exp $ * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.309 2004/08/22 00:08:28 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1421,6 +1421,7 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt, ...@@ -1421,6 +1421,7 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt,
alterstmt->relation = cxt->relation; alterstmt->relation = cxt->relation;
alterstmt->cmds = NIL; alterstmt->cmds = NIL;
alterstmt->relkind = OBJECT_TABLE;
foreach(fkclist, cxt->fkconstraints) foreach(fkclist, cxt->fkconstraints)
{ {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.472 2004/08/20 04:29:32 momjian Exp $ * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.473 2004/08/22 00:08:28 tgl Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -1166,6 +1166,7 @@ alter_table_cmds: ...@@ -1166,6 +1166,7 @@ alter_table_cmds:
| alter_table_cmds ',' alter_table_cmd { $$ = lappend($1, $3); } | alter_table_cmds ',' alter_table_cmd { $$ = lappend($1, $3); }
; ;
/* Subcommands that are for ALTER TABLE only */
alter_table_cmd: alter_table_cmd:
/* ALTER TABLE <relation> ADD [COLUMN] <coldef> */ /* ALTER TABLE <relation> ADD [COLUMN] <coldef> */
ADD opt_column columnDef ADD opt_column columnDef
...@@ -1293,13 +1294,14 @@ alter_table_cmd: ...@@ -1293,13 +1294,14 @@ alter_table_cmd:
} }
; ;
alter_rel_cmds: alter_rel_cmd { $$ = list_make1($1); } alter_rel_cmds:
alter_rel_cmd { $$ = list_make1($1); }
| alter_rel_cmds ',' alter_rel_cmd { $$ = lappend($1, $3); } | alter_rel_cmds ',' alter_rel_cmd { $$ = lappend($1, $3); }
; ;
/* Subcommands that are for ALTER TABLE or ALTER INDEX */
alter_rel_cmd: alter_rel_cmd:
/* ALTER [ TABLE | INDEX ] <name> OWNER TO UserId */ /* ALTER [TABLE|INDEX] <name> OWNER TO UserId */
OWNER TO UserId OWNER TO UserId
{ {
AlterTableCmd *n = makeNode(AlterTableCmd); AlterTableCmd *n = makeNode(AlterTableCmd);
...@@ -1307,7 +1309,7 @@ alter_rel_cmd: ...@@ -1307,7 +1309,7 @@ alter_rel_cmd:
n->name = $3; n->name = $3;
$$ = (Node *)n; $$ = (Node *)n;
} }
/* ALTER [ TABLE | INDEX ] <name> SET TABLESPACE <tablespacename> */ /* ALTER [TABLE|INDEX] <name> SET TABLESPACE <tablespacename> */
| SET TABLESPACE name | SET TABLESPACE name
{ {
AlterTableCmd *n = makeNode(AlterTableCmd); AlterTableCmd *n = makeNode(AlterTableCmd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment