Commit 1a8be8bc authored by unknown's avatar unknown

Bug#23588 SHOW COLUMNS on a temporary table causes locking issues

skip lock_type update for temporary tables


mysql-test/r/tablelock.result:
  test result
mysql-test/t/tablelock.test:
  test case
sql/sql_base.cc:
  skip lock_type update for temporary tables
parent 18f885ed
...@@ -46,3 +46,12 @@ CREATE TABLE t2 (a int); ...@@ -46,3 +46,12 @@ CREATE TABLE t2 (a int);
lock tables t1 write,t1 as b write, t2 write, t2 as c read; lock tables t1 write,t1 as b write, t2 write, t2 as c read;
drop table t2,t1; drop table t2,t1;
unlock tables; 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;
...@@ -49,3 +49,16 @@ drop table t2,t1; ...@@ -49,3 +49,16 @@ drop table t2,t1;
unlock tables; unlock tables;
# End of 4.1 tests # 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
...@@ -2852,8 +2852,12 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) ...@@ -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) 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; tables->table->grant= tables->grant;
process_view_routines: process_view_routines:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment