summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-12-16 20:49:57 +0200
committerMichael Widenius <monty@askmonty.org>2012-12-16 20:49:57 +0200
commita5a2769fed8a010b0288d8fccece8f6c0309973b (patch)
tree78d72d4c5fa2c003d5402fa30e3c183853c4f8d0
parent0a5e489b31aa162796ec16ff7bf054ee18d5ea4a (diff)
downloadmariadb-git-a5a2769fed8a010b0288d8fccece8f6c0309973b.tar.gz
Removed lock wait timeout warning when using CREATE TABLE IF EXISTS
mysql-test/r/create.result: Added test case to show that CREATE TABLE also is not waiting if table exists. mysql-test/t/create.test: Added test case to show that CREATE TABLE also is not waiting if table exists. sql/sql_base.cc: Clear also warnings from acquire_locks if we retry.
-rw-r--r--mysql-test/r/create.result6
-rw-r--r--mysql-test/t/create.test6
-rw-r--r--sql/sql_base.cc1
3 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index a40e7096660..6f0d5d376a1 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -2416,6 +2416,12 @@ 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
+create table t1 (a int, b int);
+ERROR 42S01: Table 't1' already exists
+create table t1 (a int, b int) select 2,2;
+ERROR 42S01: Table 't1' already exists
+create table t1 like t2;
+ERROR 42S01: Table 't1' already exists
select * from t1;
a b
1 1
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index c472c9f0a05..4c9592e9dab 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -2013,6 +2013,12 @@ create table if not exists t1 (a int, b int);
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;
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int, b int);
+--error ER_TABLE_EXISTS_ERROR
+create table t1 (a int, b int) select 2,2;
+--error ER_TABLE_EXISTS_ERROR
+create table t1 like t2;
disconnect user1;
connection default;
select * from t1;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index fd33881e049..75b69eebfa9 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4779,6 +4779,7 @@ lock_table_names(THD *thd,
*/
if (check_if_table_exists(thd, tables_start, 1, &exists))
DBUG_RETURN(TRUE); // Should never happen
+ thd->warning_info->clear_warning_info(thd->query_id);
thd->clear_error(); // Forget timeout error
if (exists)
{