diff options
| author | Andreas Albrecht <a.albrecht@Mac-PU08.prounix.local> | 2020-01-06 17:36:01 +0100 |
|---|---|---|
| committer | Andreas Albrecht <a.albrecht@Mac-PU08.prounix.local> | 2020-01-06 17:36:01 +0100 |
| commit | 165095be506dd1b0d4205ca4f240ce38957424da (patch) | |
| tree | 9618f9999d88237bbe2087ea71267e18820393d6 /sqlparse/engine | |
| parent | a7d9ae7c3b503123e9d0f8dee2b14b35b3fa1b5a (diff) | |
| download | sqlparse-165095be506dd1b0d4205ca4f240ce38957424da.tar.gz | |
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.
Diffstat (limited to 'sqlparse/engine')
| -rw-r--r-- | sqlparse/engine/grouping.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index 4f07bc5..3f06e8a 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -254,9 +254,9 @@ def group_operator(tlist): def valid(token): return imt(token, i=sqlcls, t=ttypes) \ - or token.match( + or (token and token.match( T.Keyword, - ('CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP')) + ('CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP'))) def post(tlist, pidx, tidx, nidx): tlist[tidx].ttype = T.Operator |
