mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
1d6addd9bb
Use open_normal_and_derived_tables instead of open_and_lock_tables when reading metadata for a table. Add two test cases, one for "USE database" and one for "SHOW COLUMNS FROM table" mysql-test/r/lock_multi.result: Updated test results for test case for bug9998 mysql-test/r/mysql.result: Updated results for test case for bug9998 mysql-test/t/lock_multi.test: Test that "show columsn from t1" is not locked by another thread having a write lock on t1 mysql-test/t/mysql.test: Add test case for BUG9998 - lock table t1 for write from mysql-test, then execute 'mysql' and call "USE test". This will test exactly what caused the bug. sql/sql_show.cc: Open tables without locking when reading metadata
45 lines
938 B
Text
45 lines
938 B
Text
drop table if exists t1,t2;
|
|
create table t1(n int);
|
|
insert into t1 values (1);
|
|
lock tables t1 write;
|
|
update low_priority t1 set n = 4;
|
|
select n from t1;
|
|
unlock tables;
|
|
n
|
|
4
|
|
drop table t1;
|
|
create table t1(n int);
|
|
insert into t1 values (1);
|
|
lock tables t1 read;
|
|
update low_priority t1 set n = 4;
|
|
select n from t1;
|
|
unlock tables;
|
|
n
|
|
1
|
|
drop table t1;
|
|
create table t1 (a int, b int);
|
|
create table t2 (c int, d int);
|
|
insert into t1 values(1,1);
|
|
insert into t1 values(2,2);
|
|
insert into t2 values(1,2);
|
|
lock table t1 read;
|
|
update t1,t2 set c=a where b=d;
|
|
select c from t2;
|
|
c
|
|
2
|
|
drop table t1;
|
|
drop table t2;
|
|
create table t1 (a int);
|
|
create table t2 (a int);
|
|
lock table t1 write, t2 write;
|
|
insert t1 select * from t2;
|
|
drop table t2;
|
|
ERROR 42S02: Table 'test.t2' doesn't exist
|
|
drop table t1;
|
|
create table t1(a int);
|
|
lock tables t1 write;
|
|
show columns from t1;
|
|
Field Type Null Key Default Extra
|
|
a int(11) YES NULL
|
|
unlock tables;
|
|
drop table t1;
|