summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--sqlparse/engine/grouping.py2
-rw-r--r--tests/test_grouping.py6
3 files changed, 9 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index 68b79e8..374c060 100644
--- a/CHANGES
+++ b/CHANGES
@@ -18,6 +18,7 @@ Bug Fixes
strip_whitespace=True (issue213, by shenlongxing).
* Fix typo in keywords list (issue229, by cbeloni).
* Fix parsing of functions in comparisons (issue230, by saaj).
+* Minor bug fixes (issue101).
Release 0.1.19 (Mar 07, 2015)
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index 68960d5..982488b 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -176,6 +176,8 @@ def group_identifier(tlist):
else:
if isinstance(t, sql.Comment) and t.is_multiline():
yield t
+ if t.ttype is T.Keyword.Order:
+ yield t
return
def _next_token(tl, i):
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 9a9dd6a..7dc1269 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -140,6 +140,12 @@ class TestGrouping(TestCaseBase):
self.assert_(isinstance(p.tokens[0].tokens[0], sql.Identifier))
self.assert_(isinstance(p.tokens[0].tokens[3], sql.Identifier))
+ def test_identifier_list_with_order(self): # issue101
+ p = sqlparse.parse('1, 2 desc, 3')[0]
+ self.assert_(isinstance(p.tokens[0], sql.IdentifierList))
+ self.assert_(isinstance(p.tokens[0].tokens[3], sql.Identifier))
+ self.ndiffAssertEqual(u(p.tokens[0].tokens[3]), '2 desc')
+
def test_where(self):
s = 'select * from foo where bar = 1 order by id desc'
p = sqlparse.parse(s)[0]