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.
*/
#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