List:Commits« Previous MessageNext Message »
From:gluh Date:February 22 2008 8:12am
Subject:bk commit into 5.0 tree (gluh:1.2585) BUG#23588
View as plain text  
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, 2008-02-22 12:12:39+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, 2008-02-22 12:12:38+04:00, gluh@stripped +9 -0
    test result

  mysql-test/t/tablelock.test@stripped, 2008-02-22 12:12:38+04:00, gluh@stripped +13 -0
    test case

  sql/sql_base.cc@stripped, 2008-02-22 12:12:38+04:00, gluh@stripped +6 -2
    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	2008-02-22 12:12:38 +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	2008-02-22 12:12:38 +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	2008-01-09 18:52:10 +04:00
+++ b/sql/sql_base.cc	2008-02-22 12:12:38 +04:00
@@ -2852,8 +2852,12 @@ int open_tables(THD *thd, TABLE_LIST **s
     }
 
     if (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;
+    {
+      if (tables->lock_type == TL_WRITE_DEFAULT)
+        tables->table->reginfo.lock_type= thd->update_lock_default;
+      else if (tables->table->s->tmp_table == NO_TMP_TABLE)
+        tables->table->reginfo.lock_type= tables->lock_type;
+    }
     tables->table->grant= tables->grant;
 
 process_view_routines:
Thread
bk commit into 5.0 tree (gluh:1.2585) BUG#23588gluh22 Feb