Uploaded a slightly improved version of the patch, "*-b", (reintroduced a sane assertion I first removed erroneously).
Extends the production "nonJoinQueryPrimary" to allow "orderByClause" and "offsetFetchFirstClause".
If we see one ore more of the above and the query expression is a SELECT (i.e. not a VALUES clause), we push the clauses into the SelectNode, else give an error message.
Up till now, the clauses haven't been pushed down to SelectNode after binding; being collected by other node types, e.g. CursorNode and InsertNode, so we add logic to SelectNode to cater for the fact we now need to make binding happen of the clauses in that node type, too. Additionally, we do the shenanigans of hoisting up order by columns into the select if not already there, and remove duplicates after binding.
Any added hoisted order by column to the operand select node must be removed from the copied list when we build the result column list for thopse nodes.
Extended two comments to reflect new reality.
Added test fixture testNestingInsideSetOperation.