Take into account the fact that pg_parse_query() returns a list of RawStmt
authorPavan Deolasee <[email protected]>
Thu, 15 Jun 2017 05:25:34 +0000 (10:55 +0530)
committerPavan Deolasee <[email protected]>
Thu, 15 Jun 2017 05:25:34 +0000 (10:55 +0530)
Starting PG 10, pg_parse_query() returns a list of RawStmt unlike a list of
parse trees. The actual parse tree is now available as RawStmt->stmt. So we
must look into the correct place to check if the supplied query is one of the
special statements such as VACUUM, CLUSTER or CREATE INDEX statement, which
needs special handling.

src/backend/tcop/postgres.c

index b10e0e44d9361a50343e2be7d4bdbf7ce93c06ca..3cc070a34b89d91704ad26f2f91395dc406fd6d0 100644 (file)
@@ -1251,11 +1251,11 @@ exec_simple_query(const char *query_string)
                 */
                if (IS_PGXC_DATANODE && IsPostmasterEnvironment)
                {
-                       if (IsA(parsetree, VacuumStmt) || IsA(parsetree, ClusterStmt))
+                       if (IsA(parsetree->stmt, VacuumStmt) || IsA(parsetree->stmt, ClusterStmt))
                                 SetForceXidFromGTM(true);
-                       else if (IsA(parsetree, ReindexStmt))
+                       else if (IsA(parsetree->stmt, ReindexStmt))
                        {
-                               ReindexStmt *stmt = (ReindexStmt *) parsetree;
+                               ReindexStmt *stmt = (ReindexStmt *) parsetree->stmt;
                                if (stmt->kind == REINDEX_OBJECT_SCHEMA ||
                                        stmt->kind == REINDEX_OBJECT_DATABASE)
                                        SetForceXidFromGTM(true);