Bug #9208 misleading error while pre-reading table info (locked)
Submitted: 15 Mar 2005 22:07 Modified: 2 May 2008 20:12
Reporter: Martin Friebe (Gold Quality Contributor) (OCA) Email Updates:
Status: Can't repeat Impact on me:
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1.11 OS:Any (*)
Assigned to: CPU Architecture:Any
Tags: qc

[15 Mar 2005 22:07] Martin Friebe
this error happens has the mysql client is "reading information for completation of table and column names"

lock a table in one database, then change to another database (wich has tables),
the client will try to read the table information for all tables in the new db, this fails for all tables, including the one which is locked;

The error displayed is (for each table)
Didn't find any fields in table `name_of_table`

Of course the tables have fields, the error msgs should include the reason for that behaviour, as the above failure easily misleads to the assumption that a whole db has been crashed.

Note also that a client holding a look can not read info for any, but the locked table,

any other client not holding a lock, can read the information for ALL tables (including such beeing locked by others)

How to repeat:
# with "client1" do
create database db1; create database db2; 
use db1; create table t1a (a int); create table t1b (a int);
use db2; create table t2a (a int); create table t2b (a int);

use db1;
lock table t1a WRITE;

use db2;
# Reading table information for completion of table and column names
# You can turn off this feature to get a quicker startup with -A
# Didn't find any fields in table 't2a'
# Didn't find any fields in table 't2b'
# Database changed

use db1;
# Didn't find any fields in table 't1b'

## Now use another client
use db2  # in client 2 => works
use db1  # in client 2 => works

unlock tables; # in client 1

drop database db1; drop database db2;

Suggested fix:
change the error message, to something including the resaon "locked"

check, why only the client holding the lock is affected. and others are not. Which function is used to read the table info? (this part might be related to bug 9207)
[2 May 2008 20:12] Jim Winstead
I'm not able to repeat this with a 5.0 or 5.1 client.