From 92511b110b0c53da67a0a4694e919bd6e18d6051 Mon Sep 17 00:00:00 2001 From: Stefan Warnat Date: Wed, 22 Oct 2025 22:43:53 +0200 Subject: [PATCH 1/2] Add 'INTERSECT' to Close Keywords in Where clause --- sqlparse/sql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlparse/sql.py b/sqlparse/sql.py index b8b50caf..7ffc9333 100644 --- a/sqlparse/sql.py +++ b/sqlparse/sql.py @@ -550,7 +550,7 @@ class Where(TokenList): """A WHERE clause.""" M_OPEN = T.Keyword, 'WHERE' M_CLOSE = T.Keyword, ( - 'ORDER BY', 'GROUP BY', 'LIMIT', 'UNION', 'UNION ALL', 'EXCEPT', + 'ORDER BY', 'GROUP BY', 'LIMIT', 'UNION', 'UNION ALL', 'EXCEPT', 'INTERSECT', 'HAVING', 'RETURNING', 'INTO') From ddf8dc009f0f8dae1e728dc1828aaee00a09b5ad Mon Sep 17 00:00:00 2001 From: Stefan Warnat Date: Wed, 22 Oct 2025 22:52:04 +0200 Subject: [PATCH 2/2] reformatting code --- sqlparse/sql.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlparse/sql.py b/sqlparse/sql.py index 7ffc9333..6338a61d 100644 --- a/sqlparse/sql.py +++ b/sqlparse/sql.py @@ -550,8 +550,8 @@ class Where(TokenList): """A WHERE clause.""" M_OPEN = T.Keyword, 'WHERE' M_CLOSE = T.Keyword, ( - 'ORDER BY', 'GROUP BY', 'LIMIT', 'UNION', 'UNION ALL', 'EXCEPT', 'INTERSECT', - 'HAVING', 'RETURNING', 'INTO') + 'ORDER BY', 'GROUP BY', 'LIMIT', 'UNION', 'UNION ALL', 'EXCEPT', + 'INTERSECT', 'HAVING', 'RETURNING', 'INTO') class Over(TokenList):