summaryrefslogtreecommitdiff
path: root/sql/sql_base.h
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-05-16 21:51:46 +0300
committerMonty <monty@mariadb.org>2018-05-16 21:51:46 +0300
commitef295c31e3d50a99a90beccfb4deb9d9d36ac1e3 (patch)
treee504c310e3f0829c2041e65e1e9cbfe7ac5fc99d /sql/sql_base.h
parentd703e09cd6706673fbb127f540d3917068b40755 (diff)
downloadmariadb-git-ef295c31e3d50a99a90beccfb4deb9d9d36ac1e3.tar.gz
MDEV-11129 CREATE OR REPLACE TABLE t1 AS SELECT spfunc() crashes if spfunc() references t1
Fixed by extending unique_table() with a flag to not allow usage of the replaced table. I also cleaned up find_dup_table() to not use goto next. I also added more comments to the code in find_dup_table()
Diffstat (limited to 'sql/sql_base.h')
-rw-r--r--sql/sql_base.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 04f132ac936..af42a15ab29 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -61,6 +61,10 @@ enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
IGNORE_ERRORS, REPORT_EXCEPT_NON_UNIQUE,
IGNORE_EXCEPT_NON_UNIQUE};
+/* Flag bits for unique_table() */
+#define CHECK_DUP_ALLOW_DIFFERENT_ALIAS 1
+#define CHECK_DUP_FOR_CREATE 2
+
uint create_tmp_table_def_key(THD *thd, char *key, const char *db,
const char *table_name);
uint get_table_def_key(const TABLE_LIST *table_list, const char **key);
@@ -254,7 +258,7 @@ void kill_delayed_threads_for_table(TABLE_SHARE *share);
void close_thread_table(THD *thd, TABLE **table_ptr);
bool close_temporary_tables(THD *thd);
TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
- bool check_alias);
+ uint check_flag);
int drop_temporary_table(THD *thd, TABLE *table, bool *is_trans);
void close_temporary_table(THD *thd, TABLE *table, bool free_share,
bool delete_table);