Skip to content

Commit 5a3164d

Browse files
committed
Optimize parsing of literal blocks between dollar signs (fixes andialbrecht#491).
1 parent 1f7edab commit 5a3164d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Bug Fixes
1111
* Fix splitting of SQL with multiple statements inside
1212
parentheses (issue485, pr486 by win39).
1313
* Correctly identify NULLS FIRST / NULLS LAST as keywords (issue487).
14+
* Fix splitting of SQL statements that contain dollar signs in
15+
identifiers (issue491).
1416

1517

1618
Release 0.3.0 (Mar 11, 2019)

sqlparse/keywords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def is_keyword(value):
3838

3939
(r"`(``|[^`])*`", tokens.Name),
4040
(r"´(´´|[^´])*´", tokens.Name),
41-
(r'(\$(?:[_A-ZÀ-Ü]\w*)?\$)[\s\S]*?\1', tokens.Literal),
41+
(r'((?<!\S)\$(?:[_A-ZÀ-Ü]\w*)?\$)[\s\S]*?\1', tokens.Literal),
4242

4343
(r'\?', tokens.Name.Placeholder),
4444
(r'%(\(\w+\))?s', tokens.Name.Placeholder),

0 commit comments

Comments
 (0)