summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2017-06-15 05:26:04 +0000
committerPavan Deolasee2017-06-15 05:26:04 +0000
commit140c2f2cb9a0474f8257fbbf0f306c766090a36e (patch)
tree3b697450347c2a9b03a4725d51f0bf9709b5d909
parent72dd9fdf7a898bddf4cfbf9b4d16bff11521d3da (diff)
Check for non-utility commands in PlannedStmt
Starting PG 10, even utility statements are wrapped in a PlannedStmt. So we must ensure that we are dealing with non-utility statements before trying to look into the planTree because it won't be set for utility statements.
-rw-r--r--src/pl/plpgsql/src/pl_exec.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 0d75a99361..73dddec35f 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -5367,6 +5367,7 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
*/
#define MAX_REMOTE_QUERY_FETCH 10000
if (IsA(linitial(portal->stmts), PlannedStmt) &&
+ (((PlannedStmt *) linitial(portal->stmts))->commandType != CMD_UTILITY) &&
IsA(((PlannedStmt *) linitial(portal->stmts))->planTree, RemoteQuery))
count = MAX_REMOTE_QUERY_FETCH;
else