summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorSachin <sachin.setiya@mariadb.com>2018-06-26 11:33:58 +0530
committersachin <sachin.setiya@mariadb.com>2018-07-18 20:58:59 +0530
commit9827c5e1031ca5ebe1c6c7d4f5eac3cce5749d8e (patch)
tree3caffa35024058bb45f3d0e29e077efbd1c38aa2 /sql/sql_parse.cc
parent1cc1d0429da14a041a6240c6fce17e0d31cad8e2 (diff)
downloadmariadb-git-9827c5e1031ca5ebe1c6c7d4f5eac3cce5749d8e.tar.gz
MDEV-16192 Table 't' is specified twice, both as a target for 'CREATE' and...
as a separate source for data Actually MDEV-15867 and MDEV-16192 are same, Slave adds "or replace" to create table stmt. So create table t1 is create or replace on slave. So this bug is not because of replication, We can get this bug on general server if we manually add or replace to create query. Problem:- So if we try to create table t1 (same name as of temp table t1 ) via CREATE or replace TABLE t AS SELECT * FROM t; Since in this query we are creating table from select * from t1 , we call unique_table function to see whether if source and destination table are same. But there is one issue unique_table does not account if source table is tmp table in this case source and destination table can be same. Solution:- We will change find_dup_table to not to look for temp table if CHECK_DUP_SKIP_TEMP_TABLE flag is on.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index df0ee2bd680..3ec7b54e0a9 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3910,8 +3910,8 @@ mysql_execute_command(THD *thd)
{
TABLE_LIST *duplicate;
if ((duplicate= unique_table(thd, lex->query_tables,
- lex->query_tables->next_global,
- CHECK_DUP_FOR_CREATE)))
+ lex->query_tables->next_global,
+ CHECK_DUP_FOR_CREATE | CHECK_DUP_SKIP_TEMP_TABLE)))
{
update_non_unique_table_error(lex->query_tables, "CREATE",
duplicate);