[MDEV-33271] mysql client: auto-vertical-output interferes with --batch mode Created: 2024-01-18 Updated: 2024-01-18 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Documentation, Scripts & Clients |
| Affects Version/s: | 10.6.11 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Mike Thompson | Assignee: | Ian Gilfillan |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux 6.1.19 on amd64 |
||
| Description |
|
A very welcome feature of the mysql CLI client, auto-vertical-output, has an unfortunate interaction with --batch mode of the client. I am quite happy to have this as my ~/.my.cnf
The unfortunate thing is that this setting interferes with the --batch mode of the client. The --batch mode is documented as writing result sets as a series of lines of tab-separated column values, one line per row--all prefixed by a line that contains tab-separated column names for the result set. I have a Bash script which happily ingests such result sets. The trouble is that when auto-vertical-output is enabled in .my.cnf and the client judges the output table is going to be too wide for the tty (based on column widths that would be in force for normal horizontal mode), the not-for-human-consumption batch output is switched to vertical mode. This query illustrates the problem:
(This assumes the CLI window is at least 45 columns wide, a generally safe assumption.) The MySQL client should write this result for the query regardless of the setting of auto-vertical-output:
Now if auto-vertical-output is enabled, changing the 45 in the above query to 500 will almost certainly give this result:
This is a bug. Here are three ways to fix it--listed in descending order of preference:
|
| Comments |
| Comment by Sergei Golubchik [ 2024-01-18 ] |
|
you can turn off any boolean option with skip- or disable- prefix. That is --disable-auto-vertical-output will do the trick. Or --skip-auto-vertical-output. Or --auto-vertical-output=0. you can specify what config file to read with --defaults-file=/path/to/file, you can specify that no config file should be read with --no-defaults. See https://mariadb.com/kb/en/mariadbd-options/#option-prefixes and https://mariadb.com/kb/en/mariadbd-options/#option-file-options |
| Comment by Sergei Golubchik [ 2024-01-18 ] |
|
greenman, isn't it confusing that options common to all tools are listed under "mariadbd-options"? Perhaps there should be, like, "common options and option prefixes" page and all pages for tools and mariadbd should refer to it? |