DERBY-6688 NPE (or sane: ASSERT failure) with ROW_NUMBER in some subqueries

In FromSubquery (used in the OK subquery) the phasing is different
than in SubqueryNode (used in the failing query): the order by list is
pushed down too late in the SubqueryNode (after the
SelectNode#preprocess), so that the fact that the order by carries an
implicit window definition isn't recorded, causing the "windows" field
to be null, leading to missing rewriting in the getProjectRestrict
phase, hence the error.

In FromSubquery, the order by list is pushed down into the child
select node just before calling its preprocess method, i.e. the order
by list is present what that happens.

The patch (derby-6688-b) moves the pushing down of the order by list
in SubqueryNode#preprocess to the resultSet (the SelectNode) to just
before the call to preprocess of the resultSet, so the rest of the
windows rewriting machinery kicks in.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616332 13f79535-47bb-0310-9956-ffa450edef68
DERBY-6689 Assert failure/NPE when using ROW_NUMBER in MERGE ... INSERT

Patch derby-6689. Adds checking for presence of window functions in
the matching clause nodes and throws 42ZC2 is that's the case. Adds a
test case.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616334 13f79535-47bb-0310-9956-ffa450edef68
DERBY-6691 ROW_NUMBER should not be allowed as argument in a procedure call

Patch *derby-6691* makes this usage throw 42ZC2 and adds a test to
OLAPTest#testBasicOperations.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1616335 13f79535-47bb-0310-9956-ffa450edef68