Skip to content

Commit 2f74e4e

Browse files
Assert that ALTER TABLE subcommands have pass set
1 parent f851361 commit 2f74e4e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/commands/tablecmds.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ static List *on_commits = NIL;
126126
* a pass determined by subcommand type.
127127
*/
128128

129+
#define AT_PASS_UNSET -1 /* UNSET will cause ERROR */
129130
#define AT_PASS_DROP 0 /* DROP (all flavors) */
130131
#define AT_PASS_ALTER_TYPE 1 /* ALTER COLUMN TYPE */
131132
#define AT_PASS_OLD_INDEX 2 /* re-add existing indexes */
@@ -2947,7 +2948,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
29472948
bool recurse, bool recursing, LOCKMODE lockmode)
29482949
{
29492950
AlteredTableInfo *tab;
2950-
int pass;
2951+
int pass = AT_PASS_UNSET;
29512952

29522953
/* Find or create work queue entry for this table */
29532954
tab = ATGetQueueEntry(wqueue, rel);
@@ -3160,9 +3161,10 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
31603161
default: /* oops */
31613162
elog(ERROR, "unrecognized alter table type: %d",
31623163
(int) cmd->subtype);
3163-
pass = 0; /* keep compiler quiet */
3164+
pass = AT_PASS_UNSET; /* keep compiler quiet */
31643165
break;
31653166
}
3167+
Assert(pass > AT_PASS_UNSET);
31663168

31673169
/* Add the subcommand to the appropriate list for phase 2 */
31683170
tab->subcmds[pass] = lappend(tab->subcmds[pass], cmd);

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