From 4e5c11727c78701c521a4814c15d8f9c780b0e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Rembia=C5=82kowski?= Date: Thu, 1 May 2025 00:46:07 +0200 Subject: [PATCH] fix: Add `ATTACH`, `DETACH` to PostgreSQL keywords. Examples of valid, not so rare statements in postgres dialect. ``` ALTER TABLE atable DETACH PARTITION atable_p00; ALTER INDEX atable_acolumn_idx ATTACH PARTITION atable_p01_acolumn_idx; ``` They fall into same class as `EXTENSION` added in below PR, so let's add them as well. In the same rationale as https://github.com/andialbrecht/sqlparse/issues/785 --- sqlparse/keywords.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index 6211e829..4683e09d 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -839,6 +839,8 @@ 'CONFLICT': tokens.Keyword, 'WINDOW': tokens.Keyword, 'PARTITION': tokens.Keyword, + 'ATTACH': tokens.Keyword, + 'DETACH': tokens.Keyword, 'OVER': tokens.Keyword, 'PERFORM': tokens.Keyword, 'NOTICE': tokens.Keyword,