diff options
| -rw-r--r-- | CHANGELOG | 2 | ||||
| -rw-r--r-- | sqlparse/keywords.py | 2 |
2 files changed, 3 insertions, 1 deletions
@@ -11,6 +11,8 @@ Bug Fixes * Fix splitting of SQL with multiple statements inside parentheses (issue485, pr486 by win39). * Correctly identify NULLS FIRST / NULLS LAST as keywords (issue487). +* Fix splitting of SQL statements that contain dollar signs in + identifiers (issue491). Release 0.3.0 (Mar 11, 2019) diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index 2444b22..5c47dfc 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -38,7 +38,7 @@ SQL_REGEX = { (r"`(``|[^`])*`", tokens.Name), (r"´(´´|[^´])*´", tokens.Name), - (r'(\$(?:[_A-ZÀ-Ü]\w*)?\$)[\s\S]*?\1', tokens.Literal), + (r'((?<!\S)\$(?:[_A-ZÀ-Ü]\w*)?\$)[\s\S]*?\1', tokens.Literal), (r'\?', tokens.Name.Placeholder), (r'%(\(\w+\))?s', tokens.Name.Placeholder), |
