diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-10-13 11:38:21 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-10-13 11:38:21 +0300 |
commit | 4a7dfda373ff9e28e4f4f35bad76cbfc20934a9a (patch) | |
tree | c8b327da16aa30bc5a26bfa31a2563af1c6f4976 /sql | |
parent | ff77a09bda884fe6bf3917eb29b9d3a2f53f919b (diff) | |
parent | 2bb8d7c2f36439ab6a3944476665eb1218c36f5c (diff) | |
download | mariadb-git-4a7dfda373ff9e28e4f4f35bad76cbfc20934a9a.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_strfunc.cc | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 4 | ||||
-rw-r--r-- | sql/sql_explain.h | 2 | ||||
-rw-r--r-- | sql/sql_insert.cc | 11 | ||||
-rw-r--r-- | sql/sql_select.cc | 41 | ||||
-rw-r--r-- | sql/sys_vars.cc | 4 | ||||
-rw-r--r-- | sql/table.cc | 3 |
7 files changed, 48 insertions, 19 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 361feb9055d..4591fb7801e 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -359,6 +359,8 @@ String *Item_aes_crypt::val_str(String *str2) rkey, AES_KEY_LENGTH / 8, 0, 0)) { str2->length((uint) aes_length); + DBUG_ASSERT(collation.collation == &my_charset_bin); + str2->set_charset(&my_charset_bin); return str2; } } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f53bb9f7451..a00b3004cc1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9808,7 +9808,9 @@ static int get_options(int *argc_ptr, char ***argv_ptr) if (global_system_variables.low_priority_updates) thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; - if (ft_boolean_check_syntax_string((uchar*) ft_boolean_syntax)) + if (ft_boolean_check_syntax_string((uchar*) ft_boolean_syntax, + strlen(ft_boolean_syntax), + system_charset_info)) { sql_print_error("Invalid ft-boolean-syntax string: %s\n", ft_boolean_syntax); diff --git a/sql/sql_explain.h b/sql/sql_explain.h index 97fe07572cf..73b9eb19435 100644 --- a/sql/sql_explain.h +++ b/sql/sql_explain.h @@ -121,11 +121,13 @@ public: */ enum explain_connection_type connection_type; +protected: /* A node may have children nodes. When a node's explain structure is created, children nodes may not yet have QPFs. This is why we store ids. */ Dynamic_array<int> children; +public: void add_child(int select_no) { children.append(select_no); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index f8b91df7941..201567c0853 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1266,7 +1266,18 @@ values_loop_end: abort: #ifndef EMBEDDED_LIBRARY if (lock_type == TL_WRITE_DELAYED) + { end_delayed_insert(thd); + /* + In case of an error (e.g. data truncation), the data type specific data + in fields (e.g. Field_blob::value) was not taken over + by the delayed writer thread. All fields in table_list->table + will be freed by free_root() soon. We need to free the specific + data before free_root() to avoid a memory leak. + */ + for (Field **ptr= table_list->table->field ; *ptr ; ptr++) + (*ptr)->free(); + } #endif if (table != NULL) table->file->ha_release_auto_increment(); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e44ba4b59e1..c943de11394 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -19996,26 +19996,33 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab, will be re-evaluated again. It could be fixed, but, probably, it's not worth doing now. */ - if (tab->select_cond && !tab->select_cond->val_int()) + if (tab->select_cond) { - /* The condition attached to table tab is false */ - if (tab == join_tab) - { - found= 0; - if (not_exists_opt_is_applicable) - DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS); - } - else + const longlong res= tab->select_cond->val_int(); + if (join->thd->is_error()) + DBUG_RETURN(NESTED_LOOP_ERROR); + + if (!res) { - /* - Set a return point if rejected predicate is attached - not to the last table of the current nest level. - */ - join->return_tab= tab; - if (not_exists_opt_is_applicable) - DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS); + /* The condition attached to table tab is false */ + if (tab == join_tab) + { + found= 0; + if (not_exists_opt_is_applicable) + DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS); + } else - DBUG_RETURN(NESTED_LOOP_OK); + { + /* + Set a return point if rejected predicate is attached + not to the last table of the current nest level. + */ + join->return_tab= tab; + if (not_exists_opt_is_applicable) + DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS); + else + DBUG_RETURN(NESTED_LOOP_OK); + } } } } diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index f873fd224fc..86d02fe11c5 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1095,7 +1095,9 @@ static Sys_var_ulong Sys_flush_time( static bool check_ftb_syntax(sys_var *self, THD *thd, set_var *var) { return ft_boolean_check_syntax_string((uchar*) - (var->save_result.string_value.str)); + (var->save_result.string_value.str), + var->save_result.string_value.length, + self->charset(thd)); } static bool query_cache_flush(sys_var *self, THD *thd, enum_var_type type) { diff --git a/sql/table.cc b/sql/table.cc index 0bef0fc29a1..e4501870a2b 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1167,7 +1167,10 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, if (check_vcol_forward_refs(field, field->vcol_info, 0) || check_vcol_forward_refs(field, field->check_constraint, 1) || check_vcol_forward_refs(field, field->default_value, 0)) + { + *error_reported= true; goto end; + } } res=0; |