Skip to content

Commit d76e8a4

Browse files
committed
Identify TRUNCATE as DDL, REVOKE/GRANT as DCL keywords.
See andialbrecht#719 as well.
1 parent f55b4e1 commit d76e8a4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Bug Fixes
2121
* Allow operators to precede dollar-quoted strings (issue763).
2222
* Fix parsing of nested order clauses (issue745, pr746 by john-bodley).
2323
* Thread-safe initialization of Lexer class (issue730).
24+
* Classify TRUNCATE as DDL and GRANT/REVOKE as DCL keywords (based on pr719
25+
by josuc1, thanks for bringing this up!)
2426

2527

2628
Release 0.4.4 (Apr 18, 2023)

sqlparse/keywords.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@
288288
'GLOBAL': tokens.Keyword,
289289
'GO': tokens.Keyword,
290290
'GOTO': tokens.Keyword,
291-
'GRANT': tokens.Keyword,
292291
'GRANTED': tokens.Keyword,
293292
'GROUPING': tokens.Keyword,
294293

@@ -477,7 +476,6 @@
477476
'RETURNED_SQLSTATE': tokens.Keyword,
478477
'RETURNING': tokens.Keyword,
479478
'RETURNS': tokens.Keyword,
480-
'REVOKE': tokens.Keyword,
481479
'RIGHT': tokens.Keyword,
482480
'ROLE': tokens.Keyword,
483481
'ROLLBACK': tokens.Keyword.DML,
@@ -577,7 +575,6 @@
577575
'TRIGGER_SCHEMA': tokens.Keyword,
578576
'TRIM': tokens.Keyword,
579577
'TRUE': tokens.Keyword,
580-
'TRUNCATE': tokens.Keyword,
581578
'TRUSTED': tokens.Keyword,
582579
'TYPE': tokens.Keyword,
583580

@@ -684,6 +681,9 @@
684681
'DROP': tokens.Keyword.DDL,
685682
'CREATE': tokens.Keyword.DDL,
686683
'ALTER': tokens.Keyword.DDL,
684+
'TRUNCATE': tokens.Keyword.DDL,
685+
'GRANT': tokens.Keyword.DCL,
686+
'REVOKE': tokens.Keyword.DCL,
687687

688688
'WHERE': tokens.Keyword,
689689
'FROM': tokens.Keyword,

0 commit comments

Comments
 (0)