File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed
Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Bug Fixes
99
1010* Fix splitting of SQL with multiple statements inside
1111 parentheses (issue485, pr486 by win39).
12+ * Correctly identify NULLS FIRST / NULLS LAST as keywords (issue487).
1213
1314
1415Release 0.3.0 (Mar 11, 2019)
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ def is_keyword(value):
7878 r'|(CROSS\s+|NATURAL\s+)?)?JOIN\b' , tokens .Keyword ),
7979 (r'END(\s+IF|\s+LOOP|\s+WHILE)?\b' , tokens .Keyword ),
8080 (r'NOT\s+NULL\b' , tokens .Keyword ),
81+ (r'NULLS\s+(FIRST|LAST)\b' , tokens .Keyword ),
8182 (r'UNION\s+ALL\b' , tokens .Keyword ),
8283 (r'CREATE(\s+OR\s+REPLACE)?\b' , tokens .Keyword .DDL ),
8384 (r'DOUBLE\s+PRECISION\b' , tokens .Name .Builtin ),
Original file line number Diff line number Diff line change @@ -171,6 +171,13 @@ def test_parse_endifloop(s):
171171 assert p .tokens [0 ].ttype is T .Keyword
172172
173173
174+ @pytest .mark .parametrize ('s' , ['NULLS FIRST' , 'NULLS LAST' ])
175+ def test_parse_nulls (s ): # issue487
176+ p = sqlparse .parse (s )[0 ]
177+ assert len (p .tokens ) == 1
178+ assert p .tokens [0 ].ttype is T .Keyword
179+
180+
174181@pytest .mark .parametrize ('s' , [
175182 'foo' ,
176183 'Foo' ,
You can’t perform that action at this time.
0 commit comments