diff options
| author | Michael Paquier | 2023-12-04 00:53:49 +0000 |
|---|---|---|
| committer | Michael Paquier | 2023-12-04 00:53:49 +0000 |
| commit | f21848de20130146bc8039504af40bd24add54cd (patch) | |
| tree | b2c95265c2ee21f151e0d5a38778adef649d451b /src/include | |
| parent | d78b6cbb602f5c36db3e267e2713b3aa22c815a5 (diff) | |
Add support for REINDEX in event triggers
This commit adds support for REINDEX in event triggers, making this
command react for the events ddl_command_start and ddl_command_end. The
indexes rebuilt are collected with the ReindexStmt emitted by the
caller, for the concurrent and non-concurrent paths.
Thanks to that, it is possible to know a full list of the indexes that a
single REINDEX command has worked on.
Author: Garrett Thornburg, Jian He
Reviewed-by: Jim Jones, Michael Paquier
Discussion: https://postgr.es/m/CAEEqfk5bm32G7sbhzHbES9WejD8O8DCEOaLkxoBP7HNWxjPpvg@mail.gmail.com
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/index.h | 8 | ||||
| -rw-r--r-- | src/include/tcop/cmdtaglist.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h index a4770eaf120..41a0b9aee1e 100644 --- a/src/include/catalog/index.h +++ b/src/include/catalog/index.h @@ -149,8 +149,9 @@ extern void index_set_state_flags(Oid indexId, IndexStateFlagsAction action); extern Oid IndexGetRelation(Oid indexId, bool missing_ok); -extern void reindex_index(Oid indexId, bool skip_constraint_checks, - char persistence, const ReindexParams *params); +extern void reindex_index(const ReindexStmt *stmt, Oid indexId, + bool skip_constraint_checks, char persistence, + const ReindexParams *params); /* Flag bits for reindex_relation(): */ #define REINDEX_REL_PROCESS_TOAST 0x01 @@ -159,7 +160,8 @@ extern void reindex_index(Oid indexId, bool skip_constraint_checks, #define REINDEX_REL_FORCE_INDEXES_UNLOGGED 0x08 #define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10 -extern bool reindex_relation(Oid relid, int flags, const ReindexParams *params); +extern bool reindex_relation(const ReindexStmt *stmt, Oid relid, int flags, + const ReindexParams *params); extern bool ReindexIsProcessingHeap(Oid heapOid); extern bool ReindexIsProcessingIndex(Oid indexOid); diff --git a/src/include/tcop/cmdtaglist.h b/src/include/tcop/cmdtaglist.h index 553a31874f1..320ee915128 100644 --- a/src/include/tcop/cmdtaglist.h +++ b/src/include/tcop/cmdtaglist.h @@ -194,7 +194,7 @@ PG_CMDTAG(CMDTAG_PREPARE, "PREPARE", false, false, false) PG_CMDTAG(CMDTAG_PREPARE_TRANSACTION, "PREPARE TRANSACTION", false, false, false) PG_CMDTAG(CMDTAG_REASSIGN_OWNED, "REASSIGN OWNED", false, false, false) PG_CMDTAG(CMDTAG_REFRESH_MATERIALIZED_VIEW, "REFRESH MATERIALIZED VIEW", true, false, false) -PG_CMDTAG(CMDTAG_REINDEX, "REINDEX", false, false, false) +PG_CMDTAG(CMDTAG_REINDEX, "REINDEX", true, false, false) PG_CMDTAG(CMDTAG_RELEASE, "RELEASE", false, false, false) PG_CMDTAG(CMDTAG_RESET, "RESET", false, false, false) PG_CMDTAG(CMDTAG_REVOKE, "REVOKE", true, false, false) |
