Repository navigation
End a statement at \G or \g in batch input - #2485
Merged
rolandwalker merged 2 commits intoNov 30, 2026
Merged
Conversation
A \G line was not a statement end, so it was sent together with the next statement and the script stopped with error 1064.
rolandwalker
requested changes
Nov 30, 2026
| statements = '' | ||
| line_counter = 0 | ||
| elif len(tokens) > 1 and tokens[-2].text == '\\' and tokens[-1].text in ('G', 'g'): | ||
| # \G and \g end a statement too, as in the mysql client |
Contributor
There was a problem hiding this comment.
We prefer "vendor client" here for consistency.
Contributor
|
Thanks! We probably do have to address the todo here. |
Contributor
Author
|
Done in f5832c7:
One side effect: the |
rolandwalker
approved these changes
Nov 30, 2026
Contributor
|
Great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
\Gline in a script isn't a statement end in--batch, stdin orsource, so it's sent together with the next statement and the script stops:mysql t < s.sqlruns both.statements_from_filehandleonly ended a statement at;(or the DELIMITER). It now also ends one when the last tokens are\Gor\g, and keeps the suffix sorun()still picks the output mode. A\Ginside a string or comment isn't a token there, so it's left alone.After a
\G, later statements in the same script also print vertically, because the expanded setting isn't reset between statements (the todo insql_execute.py). I left that alone here.Added a
test_batch_utils.pycase; it fails on main.pytest mycli_test/pytestshas the same 62 failures as main (they need a server) plus the new pass. Against MySQL 8.4, the script above now prints both rows.