Bug #12183 SHOW OPEN TABLES behavior doesn't match grammar
Submitted: 26 Jul 2005 17:18 Modified: 17 Aug 2005 16:20
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0 and up OS:Any
Assigned to: Andrey Hristov CPU Architecture:Any

[26 Jul 2005 17:18] Paul DuBois
Description:
The SHOW OPEN TABLES statement displays the open non-TEMPORARY 
tables.  For example:

mysql> show open tables;
+----------+---------+--------+-------------+
| Database | Table   | In_use | Name_locked |
+----------+---------+--------+-------------+
| test     | t       |      0 |           0 |
| sampdb   | student |      0 |           0 |
| test     | parent  |      0 |           0 |
+----------+---------+--------+-------------+
3 rows in set (0.00 sec)

The grammar for SHOW OPEN TABLES allows a FROM db_name and a LIKE
'pattern' clause.  However, I don't understand how these clauses
are supposed to work.  More precisely, it appears that they do
not work.  I suspect there are two bugs.

Bug 1) The FROM db_name clause appears to do nothing.

mysql> show open tables from test;
+----------+---------+--------+-------------+
| Database | Table   | In_use | Name_locked |
+----------+---------+--------+-------------+
| test     | t       |      0 |           0 |
| sampdb   | student |      0 |           0 |
| test     | parent  |      0 |           0 |
+----------+---------+--------+-------------+
3 rows in set (0.00 sec)

Bug 2) The LIKE 'pattern' clause appears to match the _database_
name.  I would have expected it to match the _table_ name.

mysql> show open tables like 't%';
+----------+--------+--------+-------------+
| Database | Table  | In_use | Name_locked |
+----------+--------+--------+-------------+
| test     | t      |      0 |           0 |
| test     | parent |      0 |           0 |
+----------+--------+--------+-------------+
2 rows in set (0.00 sec)

mysql> show open tables like 'p%';
Empty set (0.01 sec)

If these are real bugs, they should be fixed.
If they are not, please indicate what the expected
behavior is so that we can document it.
Thanks.

How to repeat:
See above.
[8 Aug 2005 20:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/28036
[16 Aug 2005 9:19] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/28328
[17 Aug 2005 16:20] Paul DuBois
Noted in 5.0.12 changelog and updated
SHOW OPEN TABLES section.
[28 Feb 2008 12:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/43137

ChangeSet@1.2549, 2008-02-28 15:12:23+03:00, anozdrin@quad. +2 -0
  Fix test case for Bug#12183 to make it stable.
[3 Mar 2008 18:18] Bugs System
Pushed into 5.1.24-rc
[3 Mar 2008 18:18] Bugs System
Pushed into 6.0.5-alpha
[29 Mar 2008 19:33] Jon Stephens
Also documented for 5.1.23-ndb-6.3.11 and 5.1.24.