I noticed that PlannedStmt.hasReturning and hasModifyingCTE have an
outdated comment now that MERGE supports RETURNING (per commit
c649fa24a)
i.e. these two:
> bool hasReturning; /* is it insert|update|delete RETURNING? */
> bool hasModifyingCTE; /* has insert|update|delete in WITH? */
transformWithClause() has:
/* must be a data-modifying statement */
Assert(IsA(cte->ctequery, InsertStmt) ||
IsA(cte->ctequery, UpdateStmt) ||
IsA(cte->ctequery, DeleteStmt) ||
IsA(cte->ctequery, MergeStmt));
pstate->p_hasModifyingCTE = true;
which eventually makes it into PlannedStmt.hasModifyingCTE.
The attached trivial patch fixes these.
David