summaryrefslogtreecommitdiff
path: root/sqlparse/engine
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2016-10-24 20:06:39 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2016-10-24 20:06:39 +0200
commitb68e4b781b8d74b0222411e83a16408a83cde7d6 (patch)
tree2b8538cd16986986a2f0495ded2354f293d39058 /sqlparse/engine
parentce7125072675d4c5391c5dddadb2a95946e62568 (diff)
downloadsqlparse-b68e4b781b8d74b0222411e83a16408a83cde7d6.tar.gz
Fix special case for #284 when statement starts with orphaned AS.
Diffstat (limited to 'sqlparse/engine')
-rw-r--r--sqlparse/engine/grouping.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index 5fa3909..3c49201 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -380,7 +380,7 @@ def _group(tlist, cls, match,
if match(token):
nidx, next_ = tlist.token_next(tidx)
- if valid_prev(prev_) and valid_next(next_):
+ if prev_ and valid_prev(prev_) and valid_next(next_):
from_idx, to_idx = post(tlist, pidx, tidx, nidx)
grp = tlist.group_tokens(cls, from_idx, to_idx, extend=extend)