This is an automated email from the ASF dual-hosted git repository.

huor pushed a commit to branch taoz
in repository https://gitbox.apache.org/repos/asf/hawq.git

commit 78b10628fef60bab5d23e63bd245de2d17b3d2be
Author: wcl14 <[email protected]>
AuthorDate: Tue Aug 28 21:24:37 2018 +0800

    Fix bug in refineCachedPlan and SPI_cursor_open
---
 src/backend/executor/spi.c           | 1 +
 src/backend/optimizer/plan/planner.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 9b6ae9f..374d9ed 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -1214,6 +1214,7 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
                int option = CURSOR_OPT_NO_SCROLL;
                
                if ( new_stmt && new_stmt->planTree &&
+                       queryTree->commandType != CMD_UTILITY &&
                        ExecSupportsBackwardScan(new_stmt->planTree) )
                        option = CURSOR_OPT_SCROLL;
 
diff --git a/src/backend/optimizer/plan/planner.c 
b/src/backend/optimizer/plan/planner.c
index d754df3..a5cca85 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -313,7 +313,7 @@ PlannedStmt *refineCachedPlan(PlannedStmt * plannedstmt,
   Query *my_parse = copyObject(parse);
 
   /* If this is a parallel plan. request resource and allocate split again*/
-  if (plannedstmt->planTree->dispatch == DISPATCH_PARALLEL)
+  if (my_parse->commandType != CMD_UTILITY && plannedstmt->planTree->dispatch 
== DISPATCH_PARALLEL)
   {
     /*
      * Now, we want to allocate resource.

Reply via email to