Bug #31636 Adding "--skip-column-names" for mysql-test
Submitted: 16 Oct 2007 13:46 Modified: 6 Feb 2008 14:06
Reporter: Yoshinori Matsunobu Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:5.1 OS:Any
Assigned to: Magnus Blåudd CPU Architecture:Any

[16 Oct 2007 13:46] Yoshinori Matsunobu
Description:
There is a storage engine that wants to return column names as "table_name"."column_name" if column names are duplicate between each table.

mysql> select t1.a, t2.a from t1, t2 where t1.a = t2.a;
+------+------+
| t1.a | t2.a |
+------+------+
|   34 |   34 |
+------+------+
1 row in set (0.00 sec)

Instead of (current behavior):

mysql> select t1.a , t2.a  from t1, t2 where t1.a = t2.a;
+------+------+
| a    | a    |
+------+------+
|   34 |   34 |
+------+------+
1 row in set (0.16 sec)

But most of mysql-test test cases fail just because column names are different.
By introducing "--skip-column-names" option for mysql-test, such errors can be avoided.

How to repeat:
N/A

Suggested fix:
5.1.22

--- a/client/mysqltest.c	2007-08-16 14:25:00.000000000 -0600
+++ b/client/mysqltest.c	2007-10-04 11:09:39.000000000 -0600
@@ -69,7 +69,7 @@
 enum {
   OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
   OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
-  OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR
+  OPT_MAX_CONNECT_RETRIES, OPT_MARK_PROGRESS, OPT_LOG_DIR, OPT_SKIP_COLUMN_NAMES
 };
 
 static int record= 0, opt_sleep= -1;
@@ -100,6 +100,8 @@
 static const char *load_default_groups[]= { "mysqltest", "client", 0 };
 static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
 
+static my_bool skip_column_names= 0;
+
 static uint start_lineno= 0; /* Start line of current command */
 static uint my_end_arg= 0;
 
@@ -4557,6 +4559,9 @@
   {"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select",
    (uchar**) &view_protocol, (uchar**) &view_protocol, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"skip-column-names", OPT_SKIP_COLUMN_NAMES, "Do not write column names in results",
+   (uchar**) &skip_column_names, (uchar**) &skip_column_names, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
@@ -5321,7 +5326,7 @@
 	if (display_metadata)
           append_metadata(ds, fields, num_fields);
 
-	if (!display_result_vertically)
+	if ((!display_result_vertically) && (!skip_column_names))
 	  append_table_headings(ds, fields, num_fields);
 
 	append_result(ds, res);
@@ -5659,7 +5664,7 @@
       if (display_metadata)
         append_metadata(ds, fields, num_fields);
 
-      if (!display_result_vertically)
+      if ((!display_result_vertically) && (!skip_column_names))
         append_table_headings(ds, fields, num_fields);
 
       append_stmt_result(ds, stmt, fields, num_fields);
diff -Naur a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
--- a/mysql-test/mysql-test-run.pl	2007-08-16 14:24:28.000000000 -0600
+++ b/mysql-test/mysql-test-run.pl	2007-10-04 11:11:38.000000000 -0600
@@ -178,6 +178,8 @@
 our $opt_cursor_protocol;
 our $opt_view_protocol;
 
+our $opt_skip_column_names= 0;
+
 our $opt_debug;
 our $opt_do_test;
 our @opt_cases;                  # The test cases names in argv
@@ -521,7 +523,8 @@
              'bench'                    => \$opt_bench,
              'small-bench'              => \$opt_small_bench,
              'with-ndbcluster|ndb'      => \$opt_with_ndbcluster,
+             'skip-column-names'        => \$opt_skip_column_names,
              'vs-config'            => \$opt_vs_config,
 
              # Control what test suites or cases to run
              'force'                    => \$opt_force,

@@ -4759,6 +4762,11 @@
     mtr_add_arg($args, "--password=");
   }
 
+  if ($opt_skip_column_names)
+  {
+    mtr_add_arg($args, "--skip-column-names");
+  }
+
   if ( $opt_ps_protocol )
   {
     mtr_add_arg($args, "--ps-protocol");
[6 Feb 2008 14:06] Magnus Blåudd
Conclusion is that we will not fix this since we donä't want the MySQL Server to work that way.