summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-12 14:26:34 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-12 14:26:34 +0200
commitb32bc70e340b5b0d8fcb9aa48b1b875f3f2f12dc (patch)
tree4edd8565c6eb0b1139cbb37c48f4d5f5a28798be /sql
parentf010c90807da68487b1ce4c952588c6c3def2afd (diff)
parentf72760df3390407c3cbe876e827818bc52849b71 (diff)
downloadmariadb-git-b32bc70e340b5b0d8fcb9aa48b1b875f3f2f12dc.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql')
-rw-r--r--sql/item_jsonfunc.cc5
-rw-r--r--sql/item_strfunc.h1
-rw-r--r--sql/sql_priv.h2
-rw-r--r--sql/sql_table.cc21
-rw-r--r--sql/temporary_tables.cc11
5 files changed, 19 insertions, 21 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 588d41479e1..fe8784a7073 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -1489,9 +1489,10 @@ bool Item_func_json_array::fix_length_and_dec()
if (arg_count == 0)
{
- collation.set(&my_charset_utf8_general_ci,
+ THD* thd= current_thd;
+ collation.set(thd->variables.collation_connection,
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
- tmp_val.set_charset(&my_charset_utf8_general_ci);
+ tmp_val.set_charset(thd->variables.collation_connection);
max_length= 2;
return FALSE;
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 29af0b43d9d..a458ff53d11 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1442,6 +1442,7 @@ public:
(cs->state & MY_CS_UNICODE));
}
}
+ bool is_json_type() { return args[0]->is_json_type(); }
String *val_str(String *);
longlong val_int()
{
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index e48b6195bb7..b179ae6ae40 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -126,7 +126,7 @@
#define TMP_TABLE_ALL_COLUMNS (1ULL << 12) // SELECT, intern
#define OPTION_WARNINGS (1ULL << 13) // THD, user
#define OPTION_AUTO_IS_NULL (1ULL << 14) // THD, user, binlog
-#define OPTION_NO_CHECK_CONSTRAINT_CHECKS (1ULL << 14)
+#define OPTION_NO_CHECK_CONSTRAINT_CHECKS (1ULL << 15)
#define OPTION_SAFE_UPDATES (1ULL << 16) // THD, user
#define OPTION_BUFFER_RESULT (1ULL << 17) // SELECT, user
#define OPTION_BIN_LOG (1ULL << 18) // THD, user
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f3bc8fe8bc9..36357ce765d 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2010, 2018, MariaDB
+ Copyright (c) 2010, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -9857,6 +9857,8 @@ do_continue:;
new_table->file->get_foreign_key_list(thd, &fk_list);
while ((fk= fk_list_it++))
{
+ MDL_request mdl_request;
+
if (lower_case_table_names)
{
char buf[NAME_LEN];
@@ -9868,19 +9870,14 @@ do_continue:;
len = my_casedn_str(files_charset_info, buf);
thd->make_lex_string(fk->referenced_table, buf, len);
}
- if (table_already_fk_prelocked(table_list, fk->referenced_db,
- fk->referenced_table, TL_READ_NO_INSERT))
- continue;
- TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST));
- tl->init_one_table_for_prelocking(fk->referenced_db, fk->referenced_table,
- NULL, TL_READ_NO_INSERT, TABLE_LIST::PRELOCK_FK,
- NULL, 0, &thd->lex->query_tables_last);
+ mdl_request.init(MDL_key::TABLE,
+ fk->referenced_db->str, fk->referenced_table->str,
+ MDL_SHARED_NO_WRITE, MDL_TRANSACTION);
+ if (thd->mdl_context.acquire_lock(&mdl_request,
+ thd->variables.lock_wait_timeout))
+ goto err_new_table_cleanup;
}
-
- if (open_tables(thd, &table_list->next_global, &tables_opened, 0,
- &alter_prelocking_strategy))
- goto err_new_table_cleanup;
}
}
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 917a85e6c3b..2f980993fa1 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -504,6 +504,7 @@ bool THD::close_temporary_tables()
/* Traverse the table list. */
while ((table= share->all_tmp_tables.pop_front()))
{
+ table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
free_temporary_table(table);
}
}
@@ -588,9 +589,7 @@ bool THD::rename_temporary_table(TABLE *table,
@return false Table was dropped
true Error
*/
-bool THD::drop_temporary_table(TABLE *table,
- bool *is_trans,
- bool delete_table)
+bool THD::drop_temporary_table(TABLE *table, bool *is_trans, bool delete_table)
{
DBUG_ENTER("THD::drop_temporary_table");
@@ -633,7 +632,8 @@ bool THD::drop_temporary_table(TABLE *table,
parallel replication
*/
tab->in_use= this;
-
+ if (delete_table)
+ tab->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
free_temporary_table(tab);
}
@@ -1433,8 +1433,7 @@ bool THD::log_events_and_free_tmp_shares()
@return void
*/
-void THD::free_tmp_table_share(TMP_TABLE_SHARE *share,
- bool delete_table)
+void THD::free_tmp_table_share(TMP_TABLE_SHARE *share, bool delete_table)
{
DBUG_ENTER("THD::free_tmp_table_share");