diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 96f68267cdadf69155944f1b8ba8023ebc643a5b..c6090bc663decee70b03d26458db96127dbdb5f7 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -832,3 +832,6 @@ MODIFIES SQL DATA CONTAINS SQL drop procedure p1; drop procedure p2; +show create database information_schema; +Database Create Database +information_schema CREATE DATABASE `information_schema` /*!40100 DEFAULT CHARACTER SET utf8 */ diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index b687befafc8ee34f9957361785a4af74b4d51da4..e03bea5899a574a387067e4f6f561d83ad049f30 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -552,3 +552,8 @@ select sql_data_access from information_schema.routines where specific_name like 'p%'; drop procedure p1; drop procedure p2; + +# +# Bug #9434 SHOW CREATE DATABASE information_schema; +# +show create database information_schema; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ac47c132db2f5c951f4f68798d38c9e5b4b80256..aaa34dc4cb7b2486076f0c7f434d2240edc48b34 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -448,25 +448,32 @@ bool mysqld_show_create_db(THD *thd, char *dbname, DBUG_RETURN(TRUE); } #endif - - (void) sprintf(path,"%s/%s",mysql_data_home, dbname); - length=unpack_dirname(path,path); // Convert if not unix - found_libchar= 0; - if (length && path[length-1] == FN_LIBCHAR) + if (!my_strcasecmp(system_charset_info, dbname, + information_schema_name.str)) { - found_libchar= 1; - path[length-1]=0; // remove ending '\' + dbname= information_schema_name.str; + create.default_table_charset= system_charset_info; } - if (access(path,F_OK)) + else { - my_error(ER_BAD_DB_ERROR, MYF(0), dbname); - DBUG_RETURN(TRUE); + (void) sprintf(path,"%s/%s",mysql_data_home, dbname); + length=unpack_dirname(path,path); // Convert if not unix + found_libchar= 0; + if (length && path[length-1] == FN_LIBCHAR) + { + found_libchar= 1; + path[length-1]=0; // remove ending '\' + } + if (access(path,F_OK)) + { + my_error(ER_BAD_DB_ERROR, MYF(0), dbname); + DBUG_RETURN(TRUE); + } + if (found_libchar) + path[length-1]= FN_LIBCHAR; + strmov(path+length, MY_DB_OPT_FILE); + load_db_opt(thd, path, &create); } - if (found_libchar) - path[length-1]= FN_LIBCHAR; - strmov(path+length, MY_DB_OPT_FILE); - load_db_opt(thd, path, &create); - List<Item> field_list; field_list.push_back(new Item_empty_string("Database",NAME_LEN)); field_list.push_back(new Item_empty_string("Create Database",1024));