diff options
author | Michael Paquier | 2021-01-18 05:03:10 +0000 |
---|---|---|
committer | Michael Paquier | 2021-01-18 05:03:10 +0000 |
commit | a3dc926009be833ea505eebd77ce4b72fe708b18 (patch) | |
tree | b72f640647fdb3792d66758c9080f2aca6cf5de0 /src/include/commands/cluster.h | |
parent | 04eb75e783ba49ca2e0e75088d6590b64be8ed4d (diff) |
Refactor option handling of CLUSTER, REINDEX and VACUUM
This continues the work done in b5913f6. All the options of those
commands are changed to use hex values rather than enums to reduce the
risk of compatibility bugs when introducing new options. Each option
set is moved into a new structure that can be extended with more
non-boolean options (this was already the case of VACUUM). The code of
REINDEX is restructured so as manual REINDEX commands go through a
single routine from utility.c, like VACUUM, to ease the allocation
handling of option parameters when a command needs to go through
multiple transactions.
This can be used as a base infrastructure for future patches related to
those commands, including reindex filtering and tablespace support.
Per discussion with people mentioned below, as well as Alvaro Herrera
and Peter Eisentraut.
Author: Michael Paquier, Justin Pryzby
Reviewed-by: Alexey Kondratov, Justin Pryzby
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/include/commands/cluster.h')
-rw-r--r-- | src/include/commands/cluster.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/include/commands/cluster.h b/src/include/commands/cluster.h index 401a0827aec..a941f2accda 100644 --- a/src/include/commands/cluster.h +++ b/src/include/commands/cluster.h @@ -19,15 +19,18 @@ #include "utils/relcache.h" +/* flag bits for ClusterParams->flags */ +#define CLUOPT_RECHECK 0x01 /* recheck relation state */ +#define CLUOPT_VERBOSE 0x02 /* print progress info */ + /* options for CLUSTER */ -typedef enum ClusterOption +typedef struct ClusterParams { - CLUOPT_RECHECK = 1 << 0, /* recheck relation state */ - CLUOPT_VERBOSE = 1 << 1 /* print progress info */ -} ClusterOption; + bits32 options; /* bitmask of CLUOPT_* */ +} ClusterParams; extern void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel); -extern void cluster_rel(Oid tableOid, Oid indexOid, int options); +extern void cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params); extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMODE lockmode); extern void mark_index_clustered(Relation rel, Oid indexOid, bool is_internal); |