mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Implemented MDEV-3941: CREATE TABLE xxx IF NOT EXISTS should not block if table exists.
- Added option to check_if_table_exists() to quickly check if table exists (either SHARE or .FRM) - Extended lock_table_names() to not wait for meta data locks if CREATE IF NOT EXISTS is used. mysql-test/r/create.result: New test case mysql-test/t/create.test: New test case sql/sql_base.cc: Added option to check_if_table_exists() to quickly check if table exists (either SHARE or .FRM) Extended lock_table_names() to not wait for meta data locks if CREATE IF NOT EXISTS is used. sql/sql_base.h: Updated prototype sql/sql_db.cc: Added extra argument to call to check_if_table_exists()
This commit is contained in:
@ -2403,3 +2403,21 @@ a b
|
||||
1 1
|
||||
drop table t1;
|
||||
#
|
||||
# Checking that CREATE IF NOT EXISTS is not blocked by running SELECT
|
||||
#
|
||||
create table t1 (a int, b int) engine=myisam;
|
||||
create table t2 (a int, b int) engine=myisam;
|
||||
insert into t1 values (1,1);
|
||||
lock tables t1 read;
|
||||
set @@lock_wait_timeout=5;
|
||||
create table if not exists t1 (a int, b int);
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
create table if not exists t1 (a int, b int) select 2,2;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
create table if not exists t1 like t2;
|
||||
ERROR 42S01: Table 't1' already exists
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
unlock tables;
|
||||
drop table t1,t2;
|
||||
|
Reference in New Issue
Block a user