From: Michael Paquier Date: Sun, 29 Jul 2018 13:00:42 +0000 (+0900) Subject: Fix two oversights from 9ebe0572 which refactored cluster_rel X-Git-Tag: REL_12_BETA1~1803 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f7ba88aa447a0a35006d877eec897b917d1c6c3;p=postgresql Fix two oversights from 9ebe0572 which refactored cluster_rel The recheck option became a no-op as ClusterOption failed to set proper values for each element. There was a second code path where local options got overwritten. Both issues have been spotted by Coverity. --- diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 5736f12b8f..ee32fe8871 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -1551,17 +1551,17 @@ vacuum_rel(Oid relid, RangeVar *relation, int options, VacuumParams *params) */ if (options & VACOPT_FULL) { - int options = 0; + int cluster_options = 0; /* close relation before vacuuming, but hold lock until commit */ relation_close(onerel, NoLock); onerel = NULL; if ((options & VACOPT_VERBOSE) != 0) - options |= CLUOPT_VERBOSE; + cluster_options |= CLUOPT_VERBOSE; /* VACUUM FULL is now a variant of CLUSTER; see cluster.c */ - cluster_rel(relid, InvalidOid, options); + cluster_rel(relid, InvalidOid, cluster_options); } else lazy_vacuum_rel(onerel, options, params, vac_strategy); diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 7855cff30d..07ab1a3dde 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -3114,8 +3114,8 @@ typedef struct AlterSystemStmt */ typedef enum ClusterOption { - CLUOPT_RECHECK, /* recheck relation state */ - CLUOPT_VERBOSE /* print progress info */ + CLUOPT_RECHECK = 1 << 0, /* recheck relation state */ + CLUOPT_VERBOSE = 1 << 1 /* print progress info */ } ClusterOption; typedef struct ClusterStmt