From e6d86edf4454153c655ba548b5698a4dbe5a10fd Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Mon, 3 Mar 2014 07:55:06 +0100 Subject: Improve handling of NULL in aliased identifiers. --- sqlparse/engine/grouping.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sqlparse/engine') diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index c11e5f0..bd97f41 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -117,6 +117,8 @@ def group_as(tlist): return not token.ttype in (T.DML, T.DDL) def _left_valid(token): + if token.ttype is T.Keyword and token.value in ('NULL'): + return True return token.ttype is not T.Keyword _group_left_right(tlist, T.Keyword, 'AS', sql.Identifier, @@ -233,6 +235,7 @@ def group_identifier_list(tlist): lambda t: t.ttype == T.Keyword, lambda t: isinstance(t, sql.Comparison), lambda t: isinstance(t, sql.Comment), + lambda t: t.ttype == T.Comment.Multiline, ] tcomma = tlist.token_next_match(idx, T.Punctuation, ',') start = None -- cgit v1.2.1