From eb9afb54f65d1d0ffeaa0a083bbccf0a048fb162 Mon Sep 17 00:00:00 2001 From: Mike Amy Date: Wed, 7 Nov 2012 20:39:42 +0700 Subject: Special case grouping logic for VARCHAR, otherwise it gets lost from field definitions. --- sqlparse/engine/grouping.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sqlparse') diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index 1487c24..f30d9e1 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -289,10 +289,11 @@ def group_aliased(tlist): while token: next_ = tlist.token_next(tlist.token_index(token)) if next_ is not None and isinstance(next_, clss): - grp = tlist.tokens_between(token, next_)[1:] - token.tokens.extend(grp) - for t in grp: - tlist.tokens.remove(t) + if not next_.value.upper().startswith('VARCHAR'): + grp = tlist.tokens_between(token, next_)[1:] + token.tokens.extend(grp) + for t in grp: + tlist.tokens.remove(t) idx = tlist.token_index(token) + 1 token = tlist.token_next_by_instance(idx, clss) -- cgit v1.2.1