v3.2.1
Long-standing parser bug surfaced by the new
WITHclause:ORDER BY/
GROUP BYplaced immediately before the closing)of a subquery or CTE
body now parses cleanly. Pure bug fix, no API changes.
Fixed
ORDER BY/GROUP BYimmediately before a closing)in a subquery or
CTE body (e.g.WITH cte AS (SELECT ... GROUP BY x ORDER BY y DESC) SELECT ...)
no longer throws a spuriousUnexpected PAREN_CLOSE ... expected comma or end of clause. Root cause was thatClauseBoundary::isControlKeyword()
treated only top-level clause keywords andEOFas terminators, while the
after-loop boundary check inOrderByClauseParserandGroupByClauseParser
also needs to acceptPAREN_CLOSEwhen running inside a nested statement.
The fix listsPAREN_CLOSEalongsideEOFin the boundary predicate; the
affected parsers are unchanged. Bug pre-dates the WITH work but is surfaced
more easily by CTE bodies that naturally end inORDER BY x DESC)/
GROUP BY x). Regression tests cover both subquery and CTE positions
(tests/SQL/SqlSubqueryJoinTest.php,tests/SQL/SqlWithTest.php).
Full Changelog: v3.2.0...v3.2.1