summaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorPavan Deolasee2015-06-19 11:53:05 +0000
committerPavan Deolasee2015-06-19 11:53:05 +0000
commit99eba3522ba030c779392cb50c85f3e95c8855bc (patch)
treeef91a5789bb5aeda016e67cee735eb8ebe3666cf /src/backend/tcop/postgres.c
parent17705af40dfb7aa7861066f4393bc77dc6b47bd4 (diff)
Do not run REINDEX SCHEMA inside a transaction block
This matches with Postgres's newest behaviour
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index f85916adb0..5a2420ad5a 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -1263,11 +1263,22 @@ exec_simple_query(const char *query_string)
CHECK_FOR_INTERRUPTS();
#ifdef PGXC
- /* PGXC_DATANODE */
- /* Force getting Xid from GTM for vacuum and cluster. */
- if (IS_PGXC_DATANODE && IsPostmasterEnvironment &&
- (IsA(parsetree, VacuumStmt) || IsA(parsetree, ClusterStmt)))
- SetForceXidFromGTM(true);
+ /*
+ * Force getting Xid from GTM for vacuum, cluster and reindex for
+ * database or schema
+ */
+ if (IS_PGXC_DATANODE && IsPostmasterEnvironment)
+ {
+ if (IsA(parsetree, VacuumStmt) || IsA(parsetree, ClusterStmt))
+ SetForceXidFromGTM(true);
+ else if (IsA(parsetree, ReindexStmt))
+ {
+ ReindexStmt *stmt = (ReindexStmt *) parsetree;
+ if (stmt->kind == REINDEX_OBJECT_SCHEMA ||
+ stmt->kind == REINDEX_OBJECT_DATABASE)
+ SetForceXidFromGTM(true);
+ }
+ }
#endif
/*