sql: readable human output — table by default, plus --vertical and \G support - #1342
Open
mcrauwel wants to merge 2 commits into
Open
sql: readable human output — table by default, plus --vertical and \G support#1342mcrauwel wants to merge 2 commits into
mcrauwel wants to merge 2 commits into
Conversation
pscale sql printed each row with Go's %v map formatting, which is unordered and unreadable for wide results (e.g. SHOW REPLICA STATUS). A trailing \G, which mysql users reach for out of habit, was passed to the server verbatim and rejected with a syntax error. - Render human output as a mysql-style table, columns in server order - Add --vertical to print one column per line (mysql \G style) - Strip a trailing \G / \g client terminator before sending the query; \G also enables vertical output, matching the mysql client - Render NULL as NULL instead of <nil> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mcrauwel
marked this pull request as ready for review
August 17, 2026 12:14
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cb79b21. Configure here.
A cell with embedded newlines (e.g. a GTID set) was printed verbatim mid-row, pushing later columns onto a borderless continuation line. Spread the logical row over multiple physical lines instead, padding every column on every line. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

What
pscale sqlhuman output printed each row with Go's%vmap formatting — unordered keys,map[...]syntax — which is unreadable for wide results such asSHOW REPLICA STATUS. And a trailing\G, which mysql users reach for out of habit, was sent to the server verbatim and rejected withError 1105: syntax error.This PR makes the human format render results the way the mysql client does:
NULLshown asNULL.--verticalflag: one column per line with right-aligned names (*************************** 1. row ***************************style), for wide rows.\G/\g: stripped client-side before the query is sent (they are mysql client terminators, not SQL).\Galso enables vertical output, matching mysql semantics;\gis just stripped.JSON and CSV output formats are unchanged.
Before
After
Tests
stripVerticalTerminator: trailing\G/\gwith/without whitespace, mid-string\Guntouched, bare terminatorrenderTable: golden-string check for column order, alignment, borders, NULL; multi-line values (GTID sets) sized to their longest line without breaking the tablerenderVertical: golden-string check for right-aligned names and row headersprintHumanResult: rows-affected, zero-rows, table, and vertical branches; asserts nomap[in output--verticalflag registration🤖 Generated with Claude Code