Skip to content

Commit 37d937e

Browse files
committed
Code review for ALTER INDEX patch.
1 parent 235caf4 commit 37d937e

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

src/backend/commands/alter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.8 2004/06/25 21:55:53 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.9 2004/08/22 00:08:27 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -89,6 +89,7 @@ ExecRenameStmt(RenameStmt *stmt)
8989
break;
9090

9191
case OBJECT_TABLE:
92+
case OBJECT_INDEX:
9293
case OBJECT_COLUMN:
9394
case OBJECT_TRIGGER:
9495
{
@@ -101,6 +102,7 @@ ExecRenameStmt(RenameStmt *stmt)
101102
switch (stmt->renameType)
102103
{
103104
case OBJECT_TABLE:
105+
case OBJECT_INDEX:
104106
{
105107
/*
106108
* RENAME TABLE requires that we (still) hold

src/backend/nodes/copyfuncs.c

Lines changed: 2 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-
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.289 2004/08/02 04:26:05 tgl Exp $
18+
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.290 2004/08/22 00:08:28 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -1626,6 +1626,7 @@ _copyAlterTableStmt(AlterTableStmt *from)
16261626

16271627
COPY_NODE_FIELD(relation);
16281628
COPY_NODE_FIELD(cmds);
1629+
COPY_SCALAR_FIELD(relkind);
16291630

16301631
return newnode;
16311632
}

src/backend/nodes/equalfuncs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Portions Copyright (c) 1994, Regents of the University of California
1919
*
2020
* IDENTIFICATION
21-
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.228 2004/08/02 04:26:05 tgl Exp $
21+
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.229 2004/08/22 00:08:28 tgl Exp $
2222
*
2323
*-------------------------------------------------------------------------
2424
*/
@@ -727,6 +727,7 @@ _equalAlterTableStmt(AlterTableStmt *a, AlterTableStmt *b)
727727
{
728728
COMPARE_NODE_FIELD(relation);
729729
COMPARE_NODE_FIELD(cmds);
730+
COMPARE_SCALAR_FIELD(relkind);
730731

731732
return true;
732733
}

src/backend/parser/analyze.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.308 2004/08/02 04:26:29 tgl Exp $
9+
* $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.309 2004/08/22 00:08:28 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1421,6 +1421,7 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt,
14211421

14221422
alterstmt->relation = cxt->relation;
14231423
alterstmt->cmds = NIL;
1424+
alterstmt->relkind = OBJECT_TABLE;
14241425

14251426
foreach(fkclist, cxt->fkconstraints)
14261427
{

src/backend/parser/gram.y

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.472 2004/08/20 04:29:32 momjian Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.473 2004/08/22 00:08:28 tgl Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -1166,6 +1166,7 @@ alter_table_cmds:
11661166
| alter_table_cmds ',' alter_table_cmd { $$ = lappend($1, $3); }
11671167
;
11681168

1169+
/* Subcommands that are for ALTER TABLE only */
11691170
alter_table_cmd:
11701171
/* ALTER TABLE <relation> ADD [COLUMN] <coldef> */
11711172
ADD opt_column columnDef
@@ -1293,21 +1294,22 @@ alter_table_cmd:
12931294
}
12941295
;
12951296

1296-
alter_rel_cmds: alter_rel_cmd { $$ = list_make1($1); }
1297-
| alter_rel_cmds ',' alter_rel_cmd { $$ = lappend($1, $3); }
1298-
;
1299-
1297+
alter_rel_cmds:
1298+
alter_rel_cmd { $$ = list_make1($1); }
1299+
| alter_rel_cmds ',' alter_rel_cmd { $$ = lappend($1, $3); }
1300+
;
13001301

1302+
/* Subcommands that are for ALTER TABLE or ALTER INDEX */
13011303
alter_rel_cmd:
1302-
/* ALTER [ TABLE | INDEX ] <name> OWNER TO UserId */
1304+
/* ALTER [TABLE|INDEX] <name> OWNER TO UserId */
13031305
OWNER TO UserId
13041306
{
13051307
AlterTableCmd *n = makeNode(AlterTableCmd);
13061308
n->subtype = AT_ChangeOwner;
13071309
n->name = $3;
13081310
$$ = (Node *)n;
13091311
}
1310-
/* ALTER [ TABLE | INDEX ] <name> SET TABLESPACE <tablespacename> */
1312+
/* ALTER [TABLE|INDEX] <name> SET TABLESPACE <tablespacename> */
13111313
| SET TABLESPACE name
13121314
{
13131315
AlterTableCmd *n = makeNode(AlterTableCmd);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy