summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2021-04-29 17:40:32 +0300
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:54:14 +0200
commit0b59320d3d2960355ae4afb3a434a5c81c063e12 (patch)
treeb89be8a24c4b37d9b6fc56b4cfb18654fc447309 /sql/sql_table.cc
parent0bc3a0801c914f8fc7162a67af8116738b07aa46 (diff)
downloadmariadb-git-0b59320d3d2960355ae4afb3a434a5c81c063e12.tar.gz
MDEV-19198 - DBUG assert in CREATE IF NOT EXIST under LOCK TABLES WRITE
Fixed the ASSERT to take care of the case when table already existed.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index ef92068c0d2..6be126655fc 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4504,7 +4504,7 @@ warn:
in various version of CREATE TABLE statement.
@result
- 1 unspefied error
+ 1 unspecifed error
2 error; Don't log create statement
0 ok
-1 Table was used with IF NOT EXISTS and table existed (warning, not error)
@@ -5203,14 +5203,10 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
{
/*
Ensure that we have an exclusive lock on target table if we are creating
- non-temporary table.
- If we're creating non-temporary table, then either
- - there is an exclusive lock on the table
- or
- - there was CREATE IF EXIST, and the table was not created
- (it existed), and was previously locked
+ non-temporary table. We don't have or need the lock if the create failed
+ because of existing table when using "if exists".
*/
- DBUG_ASSERT((create_info->tmp_table()) ||
+ DBUG_ASSERT((create_info->tmp_table()) || create_res < 0 ||
thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db.str,
table->table_name.str,
MDL_EXCLUSIVE) ||