The check was not effective for the same reason as
5a54abb7acd, that is
not accounting for XL wrapping the original command into RawStmt. Fix
that by checking parsetree->stmt, and also add an assert checking we
actually got a RawStmt in the first place.
RawStmt *parsetree = lfirst_node(RawStmt, lc);
List *querytree_sublist;
+ Assert(IsA(parsetree, RawStmt));
+
#ifdef PGXC
/* Block CTAS in SQL functions */
- if (IsA(parsetree, CreateTableAsStmt))
+ if (IsA(parsetree->stmt, CreateTableAsStmt))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("In XC, SQL functions cannot contain utility statements")));