mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
fix for bug #12183 "SHOW OPEN TABLES behavior doesn't match grammar"
(after review commit)
This commit is contained in:
@ -512,3 +512,46 @@ t1 CREATE TABLE `t1` (
|
|||||||
KEY `c2` USING BTREE (`c2`)
|
KEY `c2` USING BTREE (`c2`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
DROP TABLE t1;
|
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;
|
||||||
|
@ -387,3 +387,21 @@ SHOW CREATE TABLE t1;
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# 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;
|
||||||
|
@ -981,7 +981,7 @@ bool fill_record_n_invoke_before_triggers(THD *thd, Field **field,
|
|||||||
bool ignore_errors,
|
bool ignore_errors,
|
||||||
Table_triggers_list *triggers,
|
Table_triggers_list *triggers,
|
||||||
enum trg_event_type event);
|
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,
|
inline TABLE_LIST *find_table_in_global_list(TABLE_LIST *table,
|
||||||
const char *db_name,
|
const char *db_name,
|
||||||
|
@ -129,12 +129,11 @@ static void check_unused(void)
|
|||||||
# Pointer to list of names of open tables.
|
# 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;
|
int result = 0;
|
||||||
OPEN_TABLE_LIST **start_list, *open_list;
|
OPEN_TABLE_LIST **start_list, *open_list;
|
||||||
TABLE_LIST table_list;
|
TABLE_LIST table_list;
|
||||||
char name[NAME_LEN*2];
|
|
||||||
DBUG_ENTER("list_open_tables");
|
DBUG_ENTER("list_open_tables");
|
||||||
|
|
||||||
VOID(pthread_mutex_lock(&LOCK_open));
|
VOID(pthread_mutex_lock(&LOCK_open));
|
||||||
@ -151,10 +150,12 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
|
|||||||
DBUG_ASSERT(share->table_name != 0);
|
DBUG_ASSERT(share->table_name != 0);
|
||||||
if ((!share->table_name)) // To be removed
|
if ((!share->table_name)) // To be removed
|
||||||
continue; // Shouldn't happen
|
continue; // Shouldn't happen
|
||||||
|
if (db && my_strcasecmp(system_charset_info, db, share->table_cache_key))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (wild)
|
if (wild)
|
||||||
{
|
{
|
||||||
strxmov(name,share->table_cache_key,".",share->table_name,NullS);
|
if (wild_compare(share->table_name,wild,0))
|
||||||
if (wild_compare(name,wild,0))
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3189,7 +3189,8 @@ int fill_open_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||||||
TABLE *table= tables->table;
|
TABLE *table= tables->table;
|
||||||
CHARSET_INFO *cs= system_charset_info;
|
CHARSET_INFO *cs= system_charset_info;
|
||||||
OPEN_TABLE_LIST *open_list;
|
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);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
for (; open_list ; open_list=open_list->next)
|
for (; open_list ; open_list=open_list->next)
|
||||||
|
Reference in New Issue
Block a user