diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2013-06-29 00:26:46 +0100 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2013-06-29 00:26:46 +0100 |
commit | 2f74e4ec50dc625605e9a7afd63bd8a48c981d9e (patch) | |
tree | 8a74312b16d9ed3c22cbb04ef581c577150100d4 /src | |
parent | f85136106d87f54e87635736dfe1b8227b6803ad (diff) | |
download | postgresql-2f74e4ec50dc625605e9a7afd63bd8a48c981d9e.tar.gz postgresql-2f74e4ec50dc625605e9a7afd63bd8a48c981d9e.zip |
Assert that ALTER TABLE subcommands have pass set
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/tablecmds.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 8294b29b285..50341f6ef9a 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -126,6 +126,7 @@ static List *on_commits = NIL; * a pass determined by subcommand type. */ +#define AT_PASS_UNSET -1 /* UNSET will cause ERROR */ #define AT_PASS_DROP 0 /* DROP (all flavors) */ #define AT_PASS_ALTER_TYPE 1 /* ALTER COLUMN TYPE */ #define AT_PASS_OLD_INDEX 2 /* re-add existing indexes */ @@ -2947,7 +2948,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, bool recurse, bool recursing, LOCKMODE lockmode) { AlteredTableInfo *tab; - int pass; + int pass = AT_PASS_UNSET; /* Find or create work queue entry for this table */ tab = ATGetQueueEntry(wqueue, rel); @@ -3160,9 +3161,10 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, default: /* oops */ elog(ERROR, "unrecognized alter table type: %d", (int) cmd->subtype); - pass = 0; /* keep compiler quiet */ + pass = AT_PASS_UNSET; /* keep compiler quiet */ break; } + Assert(pass > AT_PASS_UNSET); /* Add the subcommand to the appropriate list for phase 2 */ tab->subcmds[pass] = lappend(tab->subcmds[pass], cmd); |