Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sqlparse/engine/statement_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def process(self, stream):
# Split on semicolon if not inside a BEGIN...END block
if self.level <= 0 and 'BEGIN' not in self._block_stack:
self.consume_ws = True
elif ttype is T.Keyword and value.split()[0] == 'GO':
elif ttype is T.Keyword and value.upper().split()[0] == 'GO':
self.consume_ws = True
elif (ttype not in (T.Whitespace, T.Newline, T.Comment.Single,
T.Comment.Multiline)
Expand Down
7 changes: 6 additions & 1 deletion tests/test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ def test_split_strip_semicolon_procedure(load_file):
@pytest.mark.parametrize('sql, num', [
('USE foo;\nGO\nSELECT 1;\nGO', 4),
('SELECT * FROM foo;\nGO', 2),
('USE foo;\nGO 2\nSELECT 1;', 3)
('USE foo;\nGO 2\nSELECT 1;', 3),
# issue762: the batch separator is case-insensitive
('USE foo;\ngo\nSELECT 1;\ngo', 4),
('USE foo;\nGo\nSELECT 1;\nGo', 4),
('SELECT * FROM foo;\ngo', 2),
('USE foo;\ngo 2\nSELECT 1;', 3),
])
def test_split_go(sql, num): # issue762
stmts = sqlparse.split(sql)
Expand Down