Skip to content

Commit

Permalink
Allow any unicode character as identifier name (fixes #641).
Browse files Browse the repository at this point in the history
  • Loading branch information
andialbrecht committed Sep 10, 2022
1 parent 07a2e81 commit b72a8ff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Bug Fixes
* Fix formatting error in EXTRACT function (issue562, issue670, pr676, by ecederstrand).
* Fix bad parsing of create table statements that use lower case (issue217, pr642, by mrmasterplan).
* Handle backtick as valid quote char (issue628, pr629, by codenamelxl).
* Allow any unicode character as valid identifier name (issue641).

Other

Expand Down
2 changes: 1 addition & 1 deletion sqlparse/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def is_keyword(value):
(r'(NOT\s+)?(REGEXP)\b', tokens.Operator.Comparison),
# Check for keywords, also returns tokens.Name if regex matches
# but the match isn't a keyword.
(r'[0-9_A-ZÀ-Ü][_$#\w]*', is_keyword),
(r'[0-9_\w][_$#\w]*', is_keyword),
(r'[;:()\[\],\.]', tokens.Punctuation),
(r'[<>=~!]+', tokens.Operator.Comparison),
(r'[+/@#%^&|^-]+', tokens.Operator),
Expand Down
1 change: 1 addition & 0 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def test_quoted_identifier():
@pytest.mark.parametrize('name', [
'foo', '_foo', # issue175
'1_data', # valid MySQL table name, see issue337
'業者名稱', # valid at least for SQLite3, see issue641
])
def test_valid_identifier_names(name):
t = sqlparse.parse(name)[0].tokens
Expand Down

0 comments on commit b72a8ff

Please sign in to comment.