honeysql/test
Brandon Adams f94e343f31 Reprioritize WITH wrt UNION and UNION ALL
WITH needs to come before clauses that are part of a UNION
or UNION ALL.[1][2][3][4]

[1] "A CTE must be followed by a single SELECT, INSERT, UPDATE, or DELETE
statement that references some or all the CTE columns."
https://docs.microsoft.com/en-us/sql/t-sql/queries/with-common-table-expression-transact-sql

[2] "the WITH clause itself is attached to a primary statement that can
also be a SELECT, INSERT, UPDATE, or DELETE"
https://www.postgresql.org/docs/9.6/static/queries-with.html

[3] https://mariadb.com/kb/en/mariadb/with/

[4] "All common table expressions (ordinary and recursive) are created
by prepending a WITH clause in front of a SELECT, INSERT, DELETE, or
UPDATE statement."
https://sqlite.org/lang_with.html

Added a test case demonstrating the expected behavior for each of
UNION and UNION ALL.
2017-06-27 20:01:52 -07:00
..
honeysql Reprioritize WITH wrt UNION and UNION ALL 2017-06-27 20:01:52 -07:00