From cd4a723ee509437166b0f3e0fd62322ecc7bbd99 Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Wed, 30 Sep 2020 08:11:53 +0200 Subject: Don't make parsing of square bracket identifiers too greedy (fixes #583). --- CHANGELOG | 1 + sqlparse/keywords.py | 2 +- tests/test_parse.py | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 789ee62..2de2a6a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,7 @@ Bug Fixes * Improved parsing of IN(...) statements (issue566, pr567 by hurcy). * Preserve line breaks when removing comments (issue484). +* Fix parsing error when using square bracket notation (issue583). Release 0.3.1 (Feb 29, 2020) diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index 91edf8c..933b323 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -73,7 +73,7 @@ SQL_REGEX = { # sqlite names can be escaped with [square brackets]. left bracket # cannot be preceded by word character or a right bracket -- # otherwise it's probably an array index - (r'(?