Bug #2666 --vertical flag for client cannot be overriden my \g on SQL query
Submitted: 6 Feb 2004 11:13 Modified: 1 Oct 2008 7:51
Reporter: Eric Raymond Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:4.0.16, 5.1.28 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[6 Feb 2004 11:13] Eric Raymond
Description:
If --vertical is set for the mysql client, then all output is vertical no matter what.  You should be able to overide this per sql command with the \g

How to repeat:
mysql --vertical

Suggested fix:
You should be able to overide this per sql command with the \g (or perhaps change the \G such that it reverses the default orientation).
[6 Feb 2004 12:22] Paul DuBois
This behavior allows you to write script files that
use \g (or ';') uniformly at the end of all queries,
then select the normal or vertical output depending
on whether or not you specify --vertical on the
command line. Otherwise you would have to actually
edit the file itself.
[6 Feb 2004 12:43] Eric Raymond
I'm not sure what the last comment meant.

Is it saying, "yes this is a valid bug. \g should overide --vertical (just like \G overides the output format when --vertical is not on the command line)."

Or is it saying, "The recommended fix (of changing the behavior of \g or \G) is the wrong approach because it may break a reasonable way to use --vertical to overide the behavior of scripts.

If it's the latter, then let's just focus on the problem (and another use case) and then see how we can address it.

Problem: I want vertical output to be the default (when I end a command with ";"), but I want to be able to run some commands with horizontal output.  There needs to be a way to escape out of vertical output for a specific command (just like \G works when --vertical is not used).

Another Solution: Add a new command "\f" which flips to orientation from the default.  If it was by default veritical, the command returns values in a horizontal. If it was by default horizontal, the command returns values in vertically.
[6 Feb 2004 12:59] Paul DuBois
Sorry, I wasn't clear.

I'm just pointing out that the currrent behavior has a use.
(So I would classify your report not as a bug, but more as
a feature request.)

One way to address the issue you raise would be to change
the behavior of --vertical. That would solve the problem for
you, but it would then cause the opposite problem for people
who rely on the current behavior.

Perhaps what is needed is statement terminators that have
an "absolute" meaning that cannot be overridden by command
line options?
[1 Oct 2008 7:51] Valeriy Kravchuk
This feature request it still relevant, I think.