Commit f3156a18 authored by bar@mysql.com's avatar bar@mysql.com

Bug#25081 SHOW FULL TABLES on table with latin chars in name fails

Problem: The Table_type column of "SHOW FULL TABLES" displayed
"ERROR" instead of "BASE TABLE" for tables having non-ascii
characters in their names.
Reason: tablename to filename encoding was missing, so
mysql_frm_type() tried to open a wrong file name.

Fix: adding tablename to filename encoding
parent 6712c096
...@@ -730,4 +730,12 @@ show keys from `mysqlttest\1`.`a\b`; ...@@ -730,4 +730,12 @@ show keys from `mysqlttest\1`.`a\b`;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
drop table `mysqlttest\1`.`a\b`; drop table `mysqlttest\1`.`a\b`;
drop database `mysqlttest\1`; drop database `mysqlttest\1`;
set names utf8;
drop table if exists `été`;
create table `été` (field1 int);
show full tables;
Tables_in_test Table_type
été BASE TABLE
drop table `été`;
set names latin1;
End of 5.1 tests End of 5.1 tests
...@@ -563,4 +563,16 @@ show keys from `mysqlttest\1`.`a\b`; ...@@ -563,4 +563,16 @@ show keys from `mysqlttest\1`.`a\b`;
drop table `mysqlttest\1`.`a\b`; drop table `mysqlttest\1`.`a\b`;
drop database `mysqlttest\1`; drop database `mysqlttest\1`;
#
# Bug#25081 SHOW FULL TABLES on table with latin chars in name fails
#
set names utf8;
--disable_warnings
drop table if exists `été`;
--enable_warnings
create table `été` (field1 int);
show full tables;
drop table `été`;
set names latin1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -2490,7 +2490,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2490,7 +2490,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
ST_SCHEMA_TABLE *schema_table= tables->schema_table; ST_SCHEMA_TABLE *schema_table= tables->schema_table;
SELECT_LEX sel; SELECT_LEX sel;
INDEX_FIELD_VALUES idx_field_vals; INDEX_FIELD_VALUES idx_field_vals;
char path[FN_REFLEN], *end, *base_name, *orig_base_name, *file_name; char path[FN_REFLEN], *base_name, *orig_base_name, *file_name;
uint len; uint len;
bool with_i_schema; bool with_i_schema;
enum enum_schema_tables schema_table_idx; enum enum_schema_tables schema_table_idx;
...@@ -2507,7 +2507,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2507,7 +2507,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
lex->view_prepare_mode= TRUE; lex->view_prepare_mode= TRUE;
DBUG_ENTER("get_all_tables"); DBUG_ENTER("get_all_tables");
LINT_INIT(end);
LINT_INIT(len); LINT_INIT(len);
lex->reset_n_backup_query_tables_list(&query_tables_list_backup); lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
...@@ -2598,7 +2597,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2598,7 +2597,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
else else
{ {
len= build_table_filename(path, sizeof(path), base_name, "", "", 0); len= build_table_filename(path, sizeof(path), base_name, "", "", 0);
end= path + len;
len= FN_LEN - len; len= FN_LEN - len;
find_files_result res= find_files(thd, &files, base_name, find_files_result res= find_files(thd, &files, base_name,
path, idx_field_vals.table_value, 0); path, idx_field_vals.table_value, 0);
...@@ -2648,7 +2646,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2648,7 +2646,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
} }
else else
{ {
my_snprintf(end, len, "/%s%s", file_name, reg_ext); build_table_filename(path, sizeof(path),
base_name, file_name, reg_ext, 0);
switch (mysql_frm_type(thd, path, &not_used)) { switch (mysql_frm_type(thd, path, &not_used)) {
case FRMTYPE_ERROR: case FRMTYPE_ERROR:
table->field[3]->store(STRING_WITH_LEN("ERROR"), table->field[3]->store(STRING_WITH_LEN("ERROR"),
......
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