Bug #47147 mysql client option --skip-column-names does not apply to vertical output
Submitted: 4 Sep 2009 21:17 Modified: 12 Mar 2010 17:31
Reporter: Harrison Fisk Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Jim Winstead CPU Architecture:Any
Tags: skip-column-names, vertical
Triage: Triaged: D4 (Minor)

[4 Sep 2009 21:17] Harrison Fisk
If you run the MySQL client with the --skip-column-names option, then it will not output the column names when you perform a query.

However, when you run a query vertically (using \G or the startup option), it still outputs the column names.

How to repeat:
mysql --skip-column-names -e 'select 1'
mysql --skip-column-names -e 'select 1' --vertical

Suggested fix:
Make it no longer output the column names.
[10 Sep 2009 17:40] Harrison Fisk
A small patch which fixes this is:

=== modified file 'client/mysql.cc'
--- client/mysql.cc     2009-08-28 16:21:54 +0000
+++ client/mysql.cc     2009-09-10 17:24:42 +0000
@@ -3510,7 +3510,8 @@
     for (uint off=0; off < mysql_num_fields(result); off++)
       field= mysql_fetch_field(result);
-      tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
+      if (column_names)
+        tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
       if (cur[off])
         unsigned int i;
[21 Sep 2009 22:21] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:


3113 Jim Winstead	2009-09-21
      The mysql command line client ignored the --skip-column-names option
      when used in conjunction with --vertical. (Bug #47147, patch by
      Harrison Fisk)
[17 Dec 2009 20:17] Jim Winstead
Queued to mysql-5.1-bugteam and mysql-pe.
[15 Jan 2010 8:59] Bugs System
Pushed into 5.1.43 (revid:joro@sun.com-20100115085139-qkh0i0fpohd9u9p5) (version source revid:jimw@mysql.com-20091217200636-jqgx9hijt8lnnpur) (merge vers: 5.1.42) (pib:16)
[16 Jan 2010 1:30] Paul Dubois
Noted in 5.1.43 changelog.

When the mysql client was invoked with the --vertical option, it
ignored the --skip-column-names option. 

Setting report to NDI pending push to 5.5.x+.
[5 Feb 2010 11:47] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100204063540-9czpdmpixi3iw2yb) (version source revid:alik@sun.com-20091224075613-es9uswo4lidkm3tj) (pib:16)
[5 Feb 2010 11:53] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100205113942-oqovjy0eoqbarn7i) (version source revid:alik@sun.com-20100204064210-ljwanqvrjs83s1gq) (merge vers: 6.0.14-alpha) (pib:16)
[5 Feb 2010 11:59] Bugs System
Pushed into 5.5.2-m2 (revid:alik@sun.com-20100203172258-1n5dsotny40yufxw) (version source revid:alexey.kopytov@sun.com-20091223134205-pk9yvgfvpn3hy7lh) (merge vers: 5.5.1-m2) (pib:16)
[5 Feb 2010 16:55] Paul Dubois
Noted in 5.5.2, 6.0.14 changelogs.

Setting report to Need Merge pending push to Celosia.
[12 Mar 2010 14:11] Bugs System
Pushed into 5.1.44-ndb-7.0.14 (revid:jonas@mysql.com-20100312135944-t0z8s1da2orvl66x) (version source revid:jonas@mysql.com-20100312115609-woou0te4a6s4ae9y) (merge vers: 5.1.44-ndb-7.0.14) (pib:16)
[12 Mar 2010 14:27] Bugs System
Pushed into 5.1.44-ndb-6.2.19 (revid:jonas@mysql.com-20100312134846-tuqhd9w3tv4xgl3d) (version source revid:jonas@mysql.com-20100312060623-mx6407w2vx76h3by) (merge vers: 5.1.44-ndb-6.2.19) (pib:16)
[12 Mar 2010 14:41] Bugs System
Pushed into 5.1.44-ndb-6.3.33 (revid:jonas@mysql.com-20100312135724-xcw8vw2lu3mijrhn) (version source revid:jonas@mysql.com-20100312103652-snkltsd197l7q2yg) (merge vers: 5.1.44-ndb-6.3.33) (pib:16)
[12 Mar 2010 17:31] Paul Dubois
Fixed in earlier 5.1.x, 5.5.x.