Commit b718dc44 authored by Sergei Golubchik's avatar Sergei Golubchik

mysql --skip-column-names flag should not affect alignment of field values,

set num_flag[] unconditionally, not under "if (column_names)"

http://ronaldbradford.com/blog/unexplained-trivial-mysql-behavior-2013-08-02/
parent cafe9d13
...@@ -3510,6 +3510,7 @@ print_table_data(MYSQL_RES *result) ...@@ -3510,6 +3510,7 @@ print_table_data(MYSQL_RES *result)
if (length < 4 && !IS_NOT_NULL(field->flags)) if (length < 4 && !IS_NOT_NULL(field->flags))
length=4; // Room for "NULL" length=4; // Room for "NULL"
field->max_length=length; field->max_length=length;
num_flag[mysql_field_tell(result) - 1]= IS_NUM(field->type);
separator.fill(separator.length()+length+2,'-'); separator.fill(separator.length()+length+2,'-');
separator.append('+'); separator.append('+');
} }
...@@ -3529,7 +3530,6 @@ print_table_data(MYSQL_RES *result) ...@@ -3529,7 +3530,6 @@ print_table_data(MYSQL_RES *result)
tee_fprintf(PAGER, " %-*s |",(int) min(display_length, tee_fprintf(PAGER, " %-*s |",(int) min(display_length,
MAX_COLUMN_LENGTH), MAX_COLUMN_LENGTH),
field->name); field->name);
num_flag[off]= IS_NUM(field->type);
} }
(void) tee_fputs("\n", PAGER); (void) tee_fputs("\n", PAGER);
tee_puts((char*) separator.ptr(), PAGER); tee_puts((char*) separator.ptr(), PAGER);
......
...@@ -515,5 +515,9 @@ aa`bb``cc ...@@ -515,5 +515,9 @@ aa`bb``cc
drop database `aa``bb````cc`; drop database `aa``bb````cc`;
a a
>>\ndelimiter\n<< >>\ndelimiter\n<<
+-------------------+
| a |
| aaaaaaaaaaaaaaaaa |
+-------------------+
End of tests End of tests
...@@ -603,5 +603,10 @@ delimiter ...@@ -603,5 +603,10 @@ delimiter
EOF EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/13639125.sql --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/13639125.sql
#
# --skip-column-names and alignment
#
--exec $MYSQL -t -N -e "SELECT 'a' union select 'aaaaaaaaaaaaaaaaa'"
--echo --echo
--echo End of tests --echo End of tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment