]> granicus.if.org Git - postgresql/commitdiff
Fix two oversights from 9ebe0572 which refactored cluster_rel
authorMichael Paquier <michael@paquier.xyz>
Sun, 29 Jul 2018 13:00:42 +0000 (22:00 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sun, 29 Jul 2018 13:00:42 +0000 (22:00 +0900)
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.

src/backend/commands/vacuum.c
src/include/nodes/parsenodes.h

index 5736f12b8f7b27ef1334390db3e50b4de810ec5a..ee32fe8871180b96e8b6c7627e958f125a78f8c5 100644 (file)
@@ -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);
index 7855cff30d28473ea6807d91895fe3ebf5796ded..07ab1a3dde1613cf08f4aaa32219577086766401 100644 (file)
@@ -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