Bug #29405 SHOW CREATE TABLE needs a DATA lock, instead of METADATA
Submitted: 27 Jun 2007 23:57 Modified: 6 Aug 2007 9:12
Reporter: Marc ALFF Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.0/5.1 OS:Any
Assigned to: CPU Architecture:Any

[27 Jun 2007 23:57] Marc ALFF
Description:
SHOW CREATE TABLE require the user to provide a DATA lock,
when using SHOW CREATE TABLE within a LOCK TABLES / UNLOCK TABLES section.

This is wrong, as SHOW CREATE TABLE does not need the table data,
but only the table metadata.

How to repeat:
use test;

drop table if exists t1;
drop table if exists t2;

create table t1 (a int);
create table t2 (b int);

lock table t1 read;

# Fails with
# query 'show create table t2' failed: 1100:
# Table 't2' was not locked with LOCK TABLES

# This should pass :
show create table t2;
unlock tables;

drop table t1;
drop table t2;

Suggested fix:
N/A
[28 Jun 2007 0:21] MySQL Verification Team
Thank you for the bug report.
[28 Jun 2007 15:01] Sergei Golubchik
Well, it shows auto_increment value, which is not metadata
[6 Aug 2007 9:12] Konstantin Osipov
As Serg suggests, auto_increment value is currently stored in the storage engine.