Skip to content

Commit b72a8ff

Browse files
committed
Allow any unicode character as identifier name (fixes #641).
1 parent 07a2e81 commit b72a8ff

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Bug Fixes
1616
* Fix formatting error in EXTRACT function (issue562, issue670, pr676, by ecederstrand).
1717
* Fix bad parsing of create table statements that use lower case (issue217, pr642, by mrmasterplan).
1818
* Handle backtick as valid quote char (issue628, pr629, by codenamelxl).
19+
* Allow any unicode character as valid identifier name (issue641).
1920

2021
Other
2122

sqlparse/keywords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def is_keyword(value):
9999
(r'(NOT\s+)?(REGEXP)\b', tokens.Operator.Comparison),
100100
# Check for keywords, also returns tokens.Name if regex matches
101101
# but the match isn't a keyword.
102-
(r'[0-9_A-ZÀ-Ü][_$#\w]*', is_keyword),
102+
(r'[0-9_\w][_$#\w]*', is_keyword),
103103
(r'[;:()\[\],\.]', tokens.Punctuation),
104104
(r'[<>=~!]+', tokens.Operator.Comparison),
105105
(r'[+/@#%^&|^-]+', tokens.Operator),

tests/test_parse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def test_quoted_identifier():
148148
@pytest.mark.parametrize('name', [
149149
'foo', '_foo', # issue175
150150
'1_data', # valid MySQL table name, see issue337
151+
'業者名稱', # valid at least for SQLite3, see issue641
151152
])
152153
def test_valid_identifier_names(name):
153154
t = sqlparse.parse(name)[0].tokens

0 commit comments

Comments
 (0)