Skip to content

Commit e575ae2

Browse files
committed
Fix parsing of backticks (fixes #588).
The backticks in this operator regex was introduced in c794c97. Pretty sure it was by mistake.
1 parent fe39072 commit e575ae2

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Development Version
22
-------------------
33

4-
Nothing yet.
4+
Bug Fixes
5+
6+
* Fix parsing of backticks (issue588).
57

68

79
Release 0.4.1 (Oct 08, 2020)

sqlparse/keywords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def is_keyword(value):
9393
(r'[0-9_A-ZÀ-Ü][_$#\w]*', is_keyword),
9494
(r'[;:()\[\],\.]', tokens.Punctuation),
9595
(r'[<>=~!]+', tokens.Operator.Comparison),
96-
(r'[+/@#%^&|`?^-]+', tokens.Operator),
96+
(r'[+/@#%^&|^-]+', tokens.Operator),
9797
]}
9898

9999
FLAGS = re.IGNORECASE | re.UNICODE

tests/test_regressions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,3 +411,10 @@ def test_format_invalid_where_clause():
411411
# did raise ValueError
412412
formatted = sqlparse.format('where, foo', reindent=True)
413413
assert formatted == 'where, foo'
414+
415+
416+
def test_splitting_at_and_backticks_issue588():
417+
splitted = sqlparse.split(
418+
'grant foo to user1@`myhost`; grant bar to user1@`myhost`;')
419+
assert len(splitted) == 2
420+
assert splitted[-1] == 'grant bar to user1@`myhost`;'

0 commit comments

Comments
 (0)