diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index a27f8f9d83..0b1884815c 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -2472,8 +2472,6 @@ void ExecReindex(ParseState *pstate, ReindexStmt *stmt, bool isTopLevel) { ReindexParams params = {0}; - bool verbose = false, - concurrently = false; ListCell *lc; char *tablespace = NULL; @@ -2483,9 +2481,11 @@ ExecReindex(ParseState *pstate, ReindexStmt *stmt, bool isTopLevel) DefElem *opt = (DefElem *) lfirst(lc); if (strcmp(opt->defname, "verbose") == 0) - verbose = defGetBoolean(opt); + params.options |= defGetBoolean(opt) ? + REINDEXOPT_VERBOSE : 0; else if (strcmp(opt->defname, "concurrently") == 0) - concurrently = defGetBoolean(opt); + params.options |= defGetBoolean(opt) ? + REINDEXOPT_CONCURRENTLY : 0; else if (strcmp(opt->defname, "tablespace") == 0) tablespace = defGetString(opt); else @@ -2496,18 +2496,12 @@ ExecReindex(ParseState *pstate, ReindexStmt *stmt, bool isTopLevel) parser_errposition(pstate, opt->location))); } - if (verbose) - params.options |= REINDEXOPT_VERBOSE; + params.tablespaceOid = tablespace ? + get_tablespace_oid(tablespace, false) : InvalidOid; - if (concurrently) - { - params.options |= REINDEXOPT_CONCURRENTLY; + if (params.options & REINDEXOPT_CONCURRENTLY) PreventInTransactionBlock(isTopLevel, "REINDEX CONCURRENTLY"); - } - - params.tablespaceOid = tablespace ? - get_tablespace_oid(tablespace, false) : InvalidOid; switch (stmt->kind) {