On Fri, Dec 04, 2020 at 04:28:26PM -0300, Alvaro Herrera wrote: > FWIW I'm with Peter on this.
Okay, attached is a patch to adjust the enums for the set of utility commands that is the set of things I have touched lately. Should that be extended more? I have not done that as a lot of those structures exist as such for a long time. -- Michael
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index c041628049..8f80f9f3aa 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -30,13 +30,10 @@ typedef enum
} IndexStateFlagsAction;
/* options for REINDEX */
-typedef enum ReindexOption
-{
- REINDEXOPT_VERBOSE = 1 << 0, /* print progress info */
- REINDEXOPT_REPORT_PROGRESS = 1 << 1, /* report pgstat progress */
- REINDEXOPT_MISSING_OK = 1 << 2, /* skip missing relations */
- REINDEXOPT_CONCURRENTLY = 1 << 3 /* concurrent mode */
-} ReindexOption;
+#define REINDEXOPT_VERBOSE (1 << 0) /* print progress info */
+#define REINDEXOPT_REPORT_PROGRESS (1 << 1) /* report pgstat progress */
+#define REINDEXOPT_MISSING_OK (1 << 2) /* skip missing relations */
+#define REINDEXOPT_CONCURRENTLY (1 << 3) /* concurrent mode */
/* state info for validate_index bulkdelete callback */
typedef struct ValidateIndexState
diff --git a/src/include/commands/cluster.h b/src/include/commands/cluster.h
index 7cfb37c9b2..ded9379818 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/cluster.h
@@ -20,11 +20,8 @@
/* options for CLUSTER */
-typedef enum ClusterOption
-{
- CLUOPT_RECHECK = 1 << 0, /* recheck relation state */
- CLUOPT_VERBOSE = 1 << 1 /* print progress info */
-} ClusterOption;
+#define CLUOPT_RECHECK (1 << 0) /* recheck relation state */
+#define CLUOPT_VERBOSE (1 << 1) /* print progress info */
extern void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel);
extern void cluster_rel(Oid tableOid, Oid indexOid, int options);
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h
index a4cd721400..1d7b6eaf04 100644
--- a/src/include/commands/vacuum.h
+++ b/src/include/commands/vacuum.h
@@ -174,17 +174,16 @@ typedef struct VacAttrStats
int rowstride;
} VacAttrStats;
-typedef enum VacuumOption
-{
- VACOPT_VACUUM = 1 << 0, /* do VACUUM */
- VACOPT_ANALYZE = 1 << 1, /* do ANALYZE */
- VACOPT_VERBOSE = 1 << 2, /* print progress info */
- VACOPT_FREEZE = 1 << 3, /* FREEZE option */
- VACOPT_FULL = 1 << 4, /* FULL (non-concurrent) vacuum */
- VACOPT_SKIP_LOCKED = 1 << 5, /* skip if cannot get lock */
- VACOPT_SKIPTOAST = 1 << 6, /* don't process the TOAST table, if any */
- VACOPT_DISABLE_PAGE_SKIPPING = 1 << 7 /* don't skip any pages */
-} VacuumOption;
+/* options for VACUUM */
+#define VACOPT_VACUUM (1 << 0) /* do VACUUM */
+#define VACOPT_ANALYZE (1 << 1) /* do ANALYZE */
+#define VACOPT_VERBOSE (1 << 2) /* print progress info */
+#define VACOPT_FREEZE (1 << 3) /* FREEZE option */
+#define VACOPT_FULL (1 << 4) /* FULL (non-concurrent) vacuum */
+#define VACOPT_SKIP_LOCKED (1 << 5) /* skip if cannot get lock */
+#define VACOPT_SKIPTOAST (1 << 6) /* don't process the TOAST table, if
+ * any */
+#define VACOPT_DISABLE_PAGE_SKIPPING (1 << 7) /* don't skip any pages */
/*
* A ternary value used by vacuum parameters.
@@ -207,7 +206,7 @@ typedef enum VacOptTernaryValue
*/
typedef struct VacuumParams
{
- int options; /* bitmask of VacuumOption */
+ int options; /* bitmask of VACOPT_* values */
int freeze_min_age; /* min freeze age, -1 to use default */
int freeze_table_age; /* age at which to scan whole table */
int multixact_freeze_min_age; /* min multixact freeze age, -1 to
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 14d24b3cc4..5e2cbba407 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -2453,7 +2453,8 @@ ChooseIndexColumnNames(List *indexElems)
/*
* ReindexParseOptions
- * Parse list of REINDEX options, returning a bitmask of ReindexOption.
+ * Parse list of REINDEX options, returning a bitmask of REINDEXOPT_*
+ * values.
*/
int
ReindexParseOptions(ParseState *pstate, ReindexStmt *stmt)
signature.asc
Description: PGP signature
