From: Date: December 17 2007 11:52am Subject: bk commit into 5.0 tree (gluh:1.2583) BUG#23588 List-Archive: http://lists.mysql.com/commits/40089 X-Bug: 23588 Message-Id: <20071217105213.45F1C24A0079@eagle.localdomain> Below is the list of changes that have just been committed into a local 5.0 repository of gluh. When gluh does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-12-17 14:52:09+04:00, gluh@stripped +3 -0 Bug#23588 SHOW COLUMNS on a temporary table causes locking issues skip lock_type update for temporary tables mysql-test/r/tablelock.result@stripped, 2007-12-17 14:52:07+04:00, gluh@stripped +9 -0 test result mysql-test/t/tablelock.test@stripped, 2007-12-17 14:52:07+04:00, gluh@stripped +13 -0 test case sql/sql_base.cc@stripped, 2007-12-17 14:52:07+04:00, gluh@stripped +2 -1 skip lock_type update for temporary tables diff -Nrup a/mysql-test/r/tablelock.result b/mysql-test/r/tablelock.result --- a/mysql-test/r/tablelock.result 2001-10-11 05:59:45 +05:00 +++ b/mysql-test/r/tablelock.result 2007-12-17 14:52:07 +04:00 @@ -46,3 +46,12 @@ CREATE TABLE t2 (a int); lock tables t1 write,t1 as b write, t2 write, t2 as c read; drop table t2,t1; unlock tables; +create temporary table t1(f1 int); +lock tables t1 write; +insert into t1 values (1); +show columns from t1; +Field Type Null Key Default Extra +f1 int(11) YES NULL +insert into t1 values(2); +drop table t1; +unlock tables; diff -Nrup a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test --- a/mysql-test/t/tablelock.test 2005-07-28 05:21:50 +05:00 +++ b/mysql-test/t/tablelock.test 2007-12-17 14:52:07 +04:00 @@ -49,3 +49,16 @@ drop table t2,t1; unlock tables; # End of 4.1 tests + +# +# Bug#23588 SHOW COLUMNS on a temporary table causes locking issues +# +create temporary table t1(f1 int); +lock tables t1 write; +insert into t1 values (1); +show columns from t1; +insert into t1 values(2); +drop table t1; +unlock tables; + +# End of 5.0 tests diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc --- a/sql/sql_base.cc 2007-11-22 05:34:24 +04:00 +++ b/sql/sql_base.cc 2007-12-17 14:52:07 +04:00 @@ -2851,7 +2851,8 @@ int open_tables(THD *thd, TABLE_LIST **s free_root(&new_frm_mem, MYF(MY_KEEP_PREALLOC)); } - if (tables->lock_type != TL_UNLOCK && ! thd->locked_tables) + if (tables->table->s->tmp_table == NO_TMP_TABLE && + tables->lock_type != TL_UNLOCK && ! thd->locked_tables) tables->table->reginfo.lock_type= tables->lock_type == TL_WRITE_DEFAULT ? thd->update_lock_default : tables->lock_type; tables->table->grant= tables->grant;