Bug #23588 SHOW COLUMNS on a temporary table causes locking issues
Submitted: 24 Oct 2006 17:35 Modified: 17 Mar 2008 20:25
Reporter: Felix Zaslavskiy Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Locking Severity:S2 (Serious)
Version:5.0.26, 5.1 BK OS:Linux (Linux)
Assigned to: Sergey Glukhov CPU Architecture:Any
Triage: D2 (Serious)

[24 Oct 2006 17:35] Felix Zaslavskiy
Description:
If a temporary table was locked with a WRITE lock and a show column is then performed on that table the lock is changed to a READ lock so making it not possible to modify the temporary table.

How to repeat:
use test;
create temporary table t ( k int );
lock tables t write;
insert into t values (1);
show columns from t;
insert into t values(2);
ERROR 1099 (HY000): Table 't' was locked with a READ lock and can't be updated

Suggested fix:
Fix the bug?
[24 Oct 2006 20:28] Sveta Smirnova
Thank you for the report.

Verified as described on Linux using last BK sources.
[24 Oct 2006 20:33] Sveta Smirnova
Version 5.1 is affected too
[17 Dec 2007 10:57] 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/40089

ChangeSet@1.2583, 2007-12-17 14:52:09+04:00, gluh@mysql.com +3 -0
  Bug#23588 SHOW COLUMNS on a temporary table causes locking issues
  skip lock_type update for temporary tables
[22 Feb 2008 8:13] 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/42802

ChangeSet@1.2585, 2008-02-22 12:12:39+04:00, gluh@mysql.com +3 -0
  Bug#23588 SHOW COLUMNS on a temporary table causes locking issues
  skip lock_type update for temporary tables
[22 Feb 2008 8:30] 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/42803

ChangeSet@1.2584, 2008-02-22 12:30:17+04:00, gluh@mysql.com +3 -0
  Bug#23588 SHOW COLUMNS on a temporary table causes locking issues
  skip lock_type update for temporary tables
[13 Mar 2008 19:28] Bugs System
Pushed into 6.0.5-alpha
[13 Mar 2008 19:35] Bugs System
Pushed into 5.1.24-rc
[13 Mar 2008 19:42] Bugs System
Pushed into 5.0.60
[17 Mar 2008 20:25] Paul Dubois
Noted in 5.0.56, 5.1.24, 6.0.5 changelogs.

SHOW COLUMNS on a TEMPOARY table caused locking issues.
[30 Mar 2008 0:07] Jon Stephens
Also documented fix in 5.1.23-ndb-6.3.11 changelog.