Skip to content

Commit 7fd16eb

Browse files
committed
fix: recognize BEGIN READ WRITE/ONLY as transaction statements
The statement splitter checks if a keyword after BEGIN is a transaction keyword to distinguish transaction statements from PL/SQL blocks. READ, ONLY and WRITE were missing from this list, causing Redshift's BEGIN READ WRITE to be treated as a block start — split() would return the entire content as one statement. Add READ, ONLY, WRITE to the transaction keyword list so BEGIN READ WRITE and BEGIN READ ONLY are correctly split as standalone transaction statements. Fixes: #843 Signed-off-by: Vincent Gao <gaobing1230@gmail.com>
1 parent f80af6a commit 7fd16eb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

sqlparse/engine/statement_splitter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def _change_splitlevel(self, ttype, value):
132132
(ttype is T.Keyword or ttype is T.Name) and \
133133
unified in ('TRANSACTION', 'WORK', 'TRAN',
134134
'DISTRIBUTED', 'DEFERRED',
135-
'IMMEDIATE', 'EXCLUSIVE'):
135+
'IMMEDIATE', 'EXCLUSIVE',
136+
'READ', 'ONLY', 'WRITE'):
136137
self._seen_begin = False
137138
if self._block_stack and self._block_stack[-1] == 'BEGIN':
138139
self._block_stack.pop()

0 commit comments

Comments
 (0)