Skip to content

Commit 165095b

Browse files
Andreas AlbrechtAndreas Albrecht
authored andcommitted
Stabilize grouping engine when parsing invalid SQL statements.
It's just to make sure, that the comparison returns a valid result when feed with invalid SQL statements.
1 parent a7d9ae7 commit 165095b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sqlparse/engine/grouping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,9 @@ def match(token):
254254

255255
def valid(token):
256256
return imt(token, i=sqlcls, t=ttypes) \
257-
or token.match(
257+
or (token and token.match(
258258
T.Keyword,
259-
('CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP'))
259+
('CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP')))
260260

261261
def post(tlist, pidx, tidx, nidx):
262262
tlist[tidx].ttype = T.Operator

0 commit comments

Comments
 (0)