diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2017-07-29 10:16:34 +0200 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2017-07-29 10:16:34 +0200 |
| commit | 113897280c612aa839fa9f8bd44bfd720d3729c7 (patch) | |
| tree | a1cb725d8525f0618441887eefe12f0ceb6248b5 /tests | |
| parent | dc788ab5b1af2e2a4a988b31a09d8d6656853f76 (diff) | |
| download | sqlparse-113897280c612aa839fa9f8bd44bfd720d3729c7.tar.gz | |
Fix parsing of UNION ALL after WHERE (fixes #349).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_grouping.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py index 76ba651..1f3a19e 100644 --- a/tests/test_grouping.py +++ b/tests/test_grouping.py @@ -216,6 +216,15 @@ def test_grouping_where(): assert isinstance(p.tokens[-1].tokens[0].tokens[-2], sql.Where) +@pytest.mark.parametrize('s', ( + 'select 1 where 1 = 2 union select 2', + 'select 1 where 1 = 2 union all select 2', +)) +def test_grouping_where_union(s): + p = sqlparse.parse(s)[0] + assert p.tokens[5].value.startswith('union') + + def test_returning_kw_ends_where_clause(): s = 'delete from foo where x > y returning z' p = sqlparse.parse(s)[0] |
