diff options
author | Michael Widenius <monty@askmonty.org> | 2012-12-16 16:13:17 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2012-12-16 16:13:17 +0200 |
commit | 33f3a11e2db38fad3c43ce3c1a30dc8d72bd53bd (patch) | |
tree | 5bd311c170eb30d9d4a3034e94537f506d4c2031 /mysql-test/t/create.test | |
parent | a6a8f12fa302aa38270370558ac3de979af4fde6 (diff) | |
download | mariadb-git-33f3a11e2db38fad3c43ce3c1a30dc8d72bd53bd.tar.gz |
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()
Diffstat (limited to 'mysql-test/t/create.test')
-rw-r--r-- | mysql-test/t/create.test | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index d80127df860..c472c9f0a05 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1996,4 +1996,25 @@ create table if not exists t1 (a int unique, b int) ignore select 1 as a, 1 as b union select 1 as a, 2 as b; select * from t1; drop table t1; + +--echo # +--echo # Checking that CREATE IF NOT EXISTS is not blocked by running SELECT --echo # + +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; +connect (user1,localhost,root,,test); +set @@lock_wait_timeout=5; +--error ER_TABLE_EXISTS_ERROR +create table if not exists t1 (a int, b int); +--error ER_TABLE_EXISTS_ERROR +create table if not exists t1 (a int, b int) select 2,2; +--error ER_TABLE_EXISTS_ERROR +create table if not exists t1 like t2; +disconnect user1; +connection default; +select * from t1; +unlock tables; +drop table t1,t2; |