Whole file

andialbrecht/sqlparse

The author described this change as Fix parsing of UNION ALL after WHERE (fixes #349).. It counts as a record because the check below fails on the code as it stood at dc788ab5b and passes on 113897280, with nothing else changed between the two runs.

Fix saved2017-07-29
Sharing licenceBSD-3-Clause · LICENSE
Change size+3 2

What the code was meant to do, written into the code itself as a save note

Fix parsing of UNION ALL after WHERE (fixes #349).

The change

526526 class Where(TokenList):
527527 """A WHERE clause."""
528528 M_OPEN = T.Keyword, 'WHERE'
529- M_CLOSE = T.Keyword, ('ORDER', 'GROUP', 'LIMIT', 'UNION', 'EXCEPT',
530- 'HAVING', 'RETURNING', 'INTO')
529+ M_CLOSE = T.Keyword, (
530+ 'ORDER', 'GROUP', 'LIMIT', 'UNION', 'UNION ALL', 'EXCEPT',
531+ 'HAVING', 'RETURNING', 'INTO')
531532
532533
533534 class Case(TokenList):

The check that tells the two apart

failpass·tests/test_grouping.py::test_grouping_where_union[select

Check file tests/test_grouping.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itdc788ab5b1af2e2a4a988b31a09d8d6656853f76
Broken version dated2017-05-25
Modulesqlparse.sql
Units changedWhere
Fingerprint03e408b8cd7535f0
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in andialbrecht/sqlparse