Loading mysql-test/r/show_check.result +43 −0 Original line number Diff line number Diff line Loading @@ -512,3 +512,46 @@ t1 CREATE TABLE `t1` ( KEY `c2` USING BTREE (`c2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE txt1(a int); CREATE TABLE tyt2(a int); CREATE TABLE urkunde(a int); FLUSH TABLES; SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone_name, txt1, tyt2, urkunde LIMIT 0; 1 SHOW OPEN TABLES; Database Table In_use Name_locked mysql db 0 0 test urkunde 0 0 mysql time_zone 0 0 mysql user 0 0 test txt1 0 0 mysql proc 0 0 test tyt2 0 0 mysql time_zone_name 0 0 SHOW OPEN TABLES FROM mysql; Database Table In_use Name_locked mysql db 0 0 mysql time_zone 0 0 mysql user 0 0 mysql proc 0 0 mysql time_zone_name 0 0 SHOW OPEN TABLES FROM mysql LIKE 'u%'; Database Table In_use Name_locked mysql user 0 0 SHOW OPEN TABLES LIKE 't%'; Database Table In_use Name_locked mysql time_zone 0 0 test txt1 0 0 test tyt2 0 0 mysql time_zone_name 0 0 SHOW OPEN TABLES LIKE '%o%'; Database Table In_use Name_locked mysql time_zone 0 0 mysql proc 0 0 mysql time_zone_name 0 0 FLUSH TABLES; SHOW OPEN TABLES; Database Table In_use Name_locked DROP TABLE txt1; DROP TABLE tyt2; DROP TABLE urkunde; mysql-test/t/show_check.test +18 −0 Original line number Diff line number Diff line Loading @@ -387,3 +387,21 @@ SHOW CREATE TABLE t1; DROP TABLE t1; # End of 4.1 tests # # BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar # First we close all open tables with FLUSH tables and then we open some. CREATE TABLE txt1(a int); CREATE TABLE tyt2(a int); CREATE TABLE urkunde(a int); FLUSH TABLES; SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone_name, txt1, tyt2, urkunde LIMIT 0; SHOW OPEN TABLES; SHOW OPEN TABLES FROM mysql; SHOW OPEN TABLES FROM mysql LIKE 'u%'; SHOW OPEN TABLES LIKE 't%'; SHOW OPEN TABLES LIKE '%o%'; FLUSH TABLES; SHOW OPEN TABLES; DROP TABLE txt1; DROP TABLE tyt2; DROP TABLE urkunde; sql/mysql_priv.h +1 −1 Original line number Diff line number Diff line Loading @@ -981,7 +981,7 @@ bool fill_record_n_invoke_before_triggers(THD *thd, Field **field, bool ignore_errors, Table_triggers_list *triggers, enum trg_event_type event); OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild); OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild); inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table, const char *db_name, Loading sql/sql_base.cc +5 −4 Original line number Diff line number Diff line Loading @@ -129,12 +129,11 @@ static void check_unused(void) # Pointer to list of names of open tables. */ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild) OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) { int result = 0; OPEN_TABLE_LIST **start_list, *open_list; TABLE_LIST table_list; char name[NAME_LEN*2]; DBUG_ENTER("list_open_tables"); VOID(pthread_mutex_lock(&LOCK_open)); Loading @@ -151,10 +150,12 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild) DBUG_ASSERT(share->table_name != 0); if ((!share->table_name)) // To be removed continue; // Shouldn't happen if (db && my_strcasecmp(system_charset_info, db, share->table_cache_key)) continue; if (wild) { strxmov(name,share->table_cache_key,".",share->table_name,NullS); if (wild_compare(name,wild,0)) if (wild_compare(share->table_name,wild,0)) continue; } Loading sql/sql_show.cc +2 −1 Original line number Diff line number Diff line Loading @@ -3189,7 +3189,8 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond) TABLE *table= tables->table; CHARSET_INFO *cs= system_charset_info; OPEN_TABLE_LIST *open_list; if (!(open_list=list_open_tables(thd,wild)) && thd->is_fatal_error) if (!(open_list=list_open_tables(thd,thd->lex->select_lex.db, wild)) && thd->is_fatal_error) DBUG_RETURN(1); for (; open_list ; open_list=open_list->next) Loading Loading
mysql-test/r/show_check.result +43 −0 Original line number Diff line number Diff line Loading @@ -512,3 +512,46 @@ t1 CREATE TABLE `t1` ( KEY `c2` USING BTREE (`c2`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE txt1(a int); CREATE TABLE tyt2(a int); CREATE TABLE urkunde(a int); FLUSH TABLES; SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone_name, txt1, tyt2, urkunde LIMIT 0; 1 SHOW OPEN TABLES; Database Table In_use Name_locked mysql db 0 0 test urkunde 0 0 mysql time_zone 0 0 mysql user 0 0 test txt1 0 0 mysql proc 0 0 test tyt2 0 0 mysql time_zone_name 0 0 SHOW OPEN TABLES FROM mysql; Database Table In_use Name_locked mysql db 0 0 mysql time_zone 0 0 mysql user 0 0 mysql proc 0 0 mysql time_zone_name 0 0 SHOW OPEN TABLES FROM mysql LIKE 'u%'; Database Table In_use Name_locked mysql user 0 0 SHOW OPEN TABLES LIKE 't%'; Database Table In_use Name_locked mysql time_zone 0 0 test txt1 0 0 test tyt2 0 0 mysql time_zone_name 0 0 SHOW OPEN TABLES LIKE '%o%'; Database Table In_use Name_locked mysql time_zone 0 0 mysql proc 0 0 mysql time_zone_name 0 0 FLUSH TABLES; SHOW OPEN TABLES; Database Table In_use Name_locked DROP TABLE txt1; DROP TABLE tyt2; DROP TABLE urkunde;
mysql-test/t/show_check.test +18 −0 Original line number Diff line number Diff line Loading @@ -387,3 +387,21 @@ SHOW CREATE TABLE t1; DROP TABLE t1; # End of 4.1 tests # # BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar # First we close all open tables with FLUSH tables and then we open some. CREATE TABLE txt1(a int); CREATE TABLE tyt2(a int); CREATE TABLE urkunde(a int); FLUSH TABLES; SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone_name, txt1, tyt2, urkunde LIMIT 0; SHOW OPEN TABLES; SHOW OPEN TABLES FROM mysql; SHOW OPEN TABLES FROM mysql LIKE 'u%'; SHOW OPEN TABLES LIKE 't%'; SHOW OPEN TABLES LIKE '%o%'; FLUSH TABLES; SHOW OPEN TABLES; DROP TABLE txt1; DROP TABLE tyt2; DROP TABLE urkunde;
sql/mysql_priv.h +1 −1 Original line number Diff line number Diff line Loading @@ -981,7 +981,7 @@ bool fill_record_n_invoke_before_triggers(THD *thd, Field **field, bool ignore_errors, Table_triggers_list *triggers, enum trg_event_type event); OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild); OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild); inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table, const char *db_name, Loading
sql/sql_base.cc +5 −4 Original line number Diff line number Diff line Loading @@ -129,12 +129,11 @@ static void check_unused(void) # Pointer to list of names of open tables. */ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild) OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) { int result = 0; OPEN_TABLE_LIST **start_list, *open_list; TABLE_LIST table_list; char name[NAME_LEN*2]; DBUG_ENTER("list_open_tables"); VOID(pthread_mutex_lock(&LOCK_open)); Loading @@ -151,10 +150,12 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild) DBUG_ASSERT(share->table_name != 0); if ((!share->table_name)) // To be removed continue; // Shouldn't happen if (db && my_strcasecmp(system_charset_info, db, share->table_cache_key)) continue; if (wild) { strxmov(name,share->table_cache_key,".",share->table_name,NullS); if (wild_compare(name,wild,0)) if (wild_compare(share->table_name,wild,0)) continue; } Loading
sql/sql_show.cc +2 −1 Original line number Diff line number Diff line Loading @@ -3189,7 +3189,8 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond) TABLE *table= tables->table; CHARSET_INFO *cs= system_charset_info; OPEN_TABLE_LIST *open_list; if (!(open_list=list_open_tables(thd,wild)) && thd->is_fatal_error) if (!(open_list=list_open_tables(thd,thd->lex->select_lex.db, wild)) && thd->is_fatal_error) DBUG_RETURN(1); for (; open_list ; open_list=open_list->next) Loading