Loading mysql-test/r/tablelock.result +9 −0 Original line number Diff line number Diff line Loading @@ -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; mysql-test/t/tablelock.test +13 −0 Original line number Diff line number Diff line Loading @@ -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 sql/sql_base.cc +6 −2 Original line number Diff line number Diff line Loading @@ -2852,8 +2852,12 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) } 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: Loading Loading
mysql-test/r/tablelock.result +9 −0 Original line number Diff line number Diff line Loading @@ -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;
mysql-test/t/tablelock.test +13 −0 Original line number Diff line number Diff line Loading @@ -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
sql/sql_base.cc +6 −2 Original line number Diff line number Diff line Loading @@ -2852,8 +2852,12 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) } 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: Loading