mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-19490 show tables fails when selecting the information_schema database
The bug was that when using mysql_list_fields, then table_list->schema_table_name was not filled in. Fixed by using table_list->schema_table instead, which is always filled in.
This commit is contained in:
@ -3398,8 +3398,7 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
|
|||||||
Check whether the information schema contains a table
|
Check whether the information schema contains a table
|
||||||
whose name is tables->schema_table_name
|
whose name is tables->schema_table_name
|
||||||
*/
|
*/
|
||||||
ST_SCHEMA_TABLE *schema_table;
|
ST_SCHEMA_TABLE *schema_table= tables->schema_table;
|
||||||
schema_table= find_schema_table(thd, tables->schema_table_name);
|
|
||||||
if (!schema_table ||
|
if (!schema_table ||
|
||||||
(schema_table->hidden &&
|
(schema_table->hidden &&
|
||||||
((sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0 ||
|
((sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0 ||
|
||||||
@ -3410,7 +3409,7 @@ open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags,
|
|||||||
lex->sql_command == SQLCOM_SHOW_KEYS)))
|
lex->sql_command == SQLCOM_SHOW_KEYS)))
|
||||||
{
|
{
|
||||||
my_error(ER_UNKNOWN_TABLE, MYF(0),
|
my_error(ER_UNKNOWN_TABLE, MYF(0),
|
||||||
tables->schema_table_name, INFORMATION_SCHEMA_NAME.str);
|
tables->table_name, INFORMATION_SCHEMA_NAME.str);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8390,6 +8390,26 @@ static void test_list_fields()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Test mysql_list_fields() with information_schema */
|
||||||
|
|
||||||
|
static void test_list_information_schema_fields()
|
||||||
|
{
|
||||||
|
MYSQL_RES *result;
|
||||||
|
int rc;
|
||||||
|
myheader("test_list_information_schema_fields");
|
||||||
|
|
||||||
|
rc= mysql_select_db(mysql, "information_schema");
|
||||||
|
myquery(rc);
|
||||||
|
result= mysql_list_fields(mysql, "all_plugins", NULL);
|
||||||
|
mytest(result);
|
||||||
|
rc= my_process_result_set(result);
|
||||||
|
DIE_UNLESS(rc == 0);
|
||||||
|
mysql_free_result(result);
|
||||||
|
rc= mysql_select_db(mysql, current_db);
|
||||||
|
myquery(rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void test_bug19671()
|
static void test_bug19671()
|
||||||
{
|
{
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
@ -19903,6 +19923,7 @@ static struct my_tests_st my_tests[]= {
|
|||||||
{ "test_fetch_column", test_fetch_column },
|
{ "test_fetch_column", test_fetch_column },
|
||||||
{ "test_mem_overun", test_mem_overun },
|
{ "test_mem_overun", test_mem_overun },
|
||||||
{ "test_list_fields", test_list_fields },
|
{ "test_list_fields", test_list_fields },
|
||||||
|
{ "test_list_fields", test_list_information_schema_fields },
|
||||||
{ "test_free_result", test_free_result },
|
{ "test_free_result", test_free_result },
|
||||||
{ "test_free_store_result", test_free_store_result },
|
{ "test_free_store_result", test_free_store_result },
|
||||||
{ "test_sqlmode", test_sqlmode },
|
{ "test_sqlmode", test_sqlmode },
|
||||||
|
Reference in New Issue
Block a user