summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/show_check.result71
-rw-r--r--mysql-test/t/show_check.test70
2 files changed, 85 insertions, 56 deletions
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 103b3c9a289..d1eb213670e 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -662,53 +662,44 @@ t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect
show create table t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
drop table if exists t1;
-CREATE TABLE txt1(a int);
-CREATE TABLE tyt2(a int);
-CREATE TABLE urkunde(a int);
+
+# Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar.
+
+DROP DATABASE IF EXISTS mysqltest1;
+CREATE DATABASE mysqltest1;
+use mysqltest1;
+
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(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;
+
+SELECT 1 FROM t1;
1
-SHOW OPEN TABLES;
-Database Table In_use Name_locked
-mysql db 0 0
-test urkunde 0 0
-mysql time_zone 0 0
-mysql general_log 0 0
-test txt1 0 0
-mysql proc 0 0
-test tyt2 0 0
-mysql user 0 0
-mysql time_zone_name 0 0
-SHOW OPEN TABLES FROM mysql;
+SELECT 1 FROM t2;
+1
+
+SHOW OPEN TABLES FROM mysqltest1;
Database Table In_use Name_locked
-mysql db 0 0
-mysql time_zone 0 0
-mysql general_log 0 0
-mysql proc 0 0
-mysql user 0 0
-mysql time_zone_name 0 0
-SHOW OPEN TABLES FROM mysql LIKE 'u%';
+mysqltest1 t1 0 0
+mysqltest1 t2 0 0
+
+SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%';
Database Table In_use Name_locked
-mysql user 0 0
-SHOW OPEN TABLES LIKE 't%';
+
+SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%';
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%';
+mysqltest1 t1 0 0
+
+SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%';
Database Table In_use Name_locked
-mysql time_zone 0 0
-mysql general_log 0 0
-mysql proc 0 0
-mysql time_zone_name 0 0
+mysqltest1 t1 0 0
+
FLUSH TABLES;
-SHOW OPEN TABLES;
-Database Table In_use Name_locked
-mysql general_log 0 0
-DROP TABLE txt1;
-DROP TABLE tyt2;
-DROP TABLE urkunde;
+
+DROP DATABASE mysqltest1;
+use test;
+
SHOW TABLES FROM non_existing_database;
ERROR 42000: Unknown database 'non_existing_database'
End of 4.1 tests
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 613e9acc4c4..9d32b50fd74 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -435,28 +435,66 @@ drop table if exists t1;
# 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);
-# make the output deterministic:
-# the order used in SHOW OPEN TABLES
-# is too much implementation dependent
+--echo
+--echo # Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar.
+--echo
+
+# NOTE: SHOW OPEN TABLES does not sort result list by database or table names.
+# Tables are listed in the order they were opened. We can not use the system
+# database (mysql) for the test here, because we have no control over the order
+# of opening tables in it. Consequently, we can not use 'SHOW OPEN TABLES'.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+use mysqltest1;
+
+--echo
+
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(a INT);
+
+--echo
+
--disable_ps_protocol
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%';
+
+--echo
+
+SELECT 1 FROM t1;
+SELECT 1 FROM t2;
+
+--echo
+
+SHOW OPEN TABLES FROM mysqltest1;
+
+--echo
+
+SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%';
+
+--echo
+
+SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%';
+
+--echo
+
+SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%';
+
+--echo
+
FLUSH TABLES;
-SHOW OPEN TABLES;
--enable_ps_protocol
-DROP TABLE txt1;
-DROP TABLE tyt2;
-DROP TABLE urkunde;
+--echo
+
+DROP DATABASE mysqltest1;
+use test;
+
+--echo
+
#
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
#