diff options
author | Sachin <sachin.setiya@mariadb.com> | 2018-06-26 11:33:58 +0530 |
---|---|---|
committer | sachin <sachin.setiya@mariadb.com> | 2018-07-18 20:58:59 +0530 |
commit | 9827c5e1031ca5ebe1c6c7d4f5eac3cce5749d8e (patch) | |
tree | 3caffa35024058bb45f3d0e29e077efbd1c38aa2 /sql/sql_base.h | |
parent | 1cc1d0429da14a041a6240c6fce17e0d31cad8e2 (diff) | |
download | mariadb-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_base.h')
-rw-r--r-- | sql/sql_base.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h index 914cdcd4512..4f99111cbd9 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -64,6 +64,7 @@ enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND, /* Flag bits for unique_table() */ #define CHECK_DUP_ALLOW_DIFFERENT_ALIAS 1 #define CHECK_DUP_FOR_CREATE 2 +#define CHECK_DUP_SKIP_TEMP_TABLE 4 uint get_table_def_key(const TABLE_LIST *table_list, const char **key); TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update, |