diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 12:21:08 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 12:21:08 +0200 |
commit | 65e8506ca9d03967191b6ed207cf107d311f7f99 (patch) | |
tree | 3076ff798884b52655a5961be21e799708a4b628 /sql | |
parent | 6adfce9c8d2a63a259dd0504600271498dcda228 (diff) | |
parent | faddcf3c395da640b760c3f701f5bc1f3baae6c4 (diff) | |
download | mariadb-git-mariadb-10.4.26.tar.gz |
Merge branch '10.3' into bb-10.4-releasemariadb-10.4.26
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_jsonfunc.cc | 4 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 1 | ||||
-rw-r--r-- | sql/mysqld.cc | 8 | ||||
-rw-r--r-- | sql/sql_cache.cc | 6 | ||||
-rw-r--r-- | sql/sql_class.h | 4 | ||||
-rw-r--r-- | sql/sql_error.h | 10 | ||||
-rw-r--r-- | sql/sql_union.cc | 23 | ||||
-rw-r--r-- | sql/strfunc.cc | 2 |
8 files changed, 45 insertions, 13 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 828ab690225..299a1626d64 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -2598,10 +2598,8 @@ String *Item_func_json_merge_patch::val_str(String *str) if (json_read_value(&je2)) goto error_return; if (je2.value_type == JSON_VALUE_OBJECT) - { - merge_to_null= true; goto cont_point; - } + merge_to_null= false; str->set(js2->ptr(), js2->length(), js2->charset()); goto cont_point; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 68d49b90475..8f7d6e97ca6 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -4305,6 +4305,7 @@ String *Item_func_compress::val_str(String *str) } str->length((uint32)new_size + 4); + str->set_charset(&my_charset_bin); return str; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9f03e4e819a..fa9a520a325 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4417,15 +4417,15 @@ static int init_common_variables() /* check log options and issue warnings if needed */ if (opt_log && opt_logname && *opt_logname && !(log_output_options & (LOG_FILE | LOG_NONE))) - sql_print_warning("Although a path was specified for the " - "--log option, log tables are used. " + sql_print_warning("Although a general log file was specified, " + "log tables are used. " "To enable logging to files use the --log-output option."); if (global_system_variables.sql_log_slow && opt_slow_logname && *opt_slow_logname && !(log_output_options & (LOG_FILE | LOG_NONE))) - sql_print_warning("Although a path was specified for the " - "--log-slow-queries option, log tables are used. " + sql_print_warning("Although a slow query log file was specified, " + "log tables are used. " "To enable logging to files use the --log-output=file option."); if (!opt_logname || !*opt_logname) diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index bef3318f974..a19bd34bde4 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1205,7 +1205,7 @@ void Query_cache::end_of_result(THD *thd) BLOCK_LOCK_WR(query_block); Query_cache_query *header= query_block->query(); Query_cache_block *last_result_block; - size_t allign_size; + size_t align_size; size_t len; if (header->result() == 0) @@ -1223,8 +1223,8 @@ void Query_cache::end_of_result(THD *thd) DBUG_VOID_RETURN; } last_result_block= header->result()->prev; - allign_size= ALIGN_SIZE(last_result_block->used); - len= MY_MAX(query_cache.min_allocation_unit, allign_size); + align_size= ALIGN_SIZE(last_result_block->used); + len= MY_MAX(query_cache.min_allocation_unit, align_size); if (last_result_block->length >= query_cache.min_allocation_unit + len) query_cache.split_block(last_result_block,len); diff --git a/sql/sql_class.h b/sql/sql_class.h index 0301eeec093..9aa243309a5 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5856,10 +5856,12 @@ class select_union_recursive :public select_unit or for the unit specifying a CTE that mutually recursive with this CTE. */ uint cleanup_count; + long row_counter; select_union_recursive(THD *thd_arg): select_unit(thd_arg), - incr_table(0), first_rec_table_to_update(0), cleanup_count(0) + incr_table(0), first_rec_table_to_update(0), cleanup_count(0), + row_counter(0) { incr_table_param.init(); }; int send_data(List<Item> &items); diff --git a/sql/sql_error.h b/sql/sql_error.h index bb83d8af800..12926d7209f 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -722,6 +722,13 @@ private: /** Reset the current row counter. Start counting from the first row. */ void reset_current_row_for_warning() { m_current_row_for_warning= 1; } + ulong set_current_row_for_warning(ulong row) + { + ulong old_row= m_current_row_for_warning; + m_current_row_for_warning= row; + return old_row; + } + /** Return the current counter value. */ ulong current_row_for_warning() const { return m_current_row_for_warning; } @@ -1130,6 +1137,9 @@ public: void opt_clear_warning_info(ulonglong query_id) { get_warning_info()->opt_clear(query_id); } + long set_current_row_for_warning(long row) + { return get_warning_info()->set_current_row_for_warning(row); } + ulong current_row_for_warning() const { return get_warning_info()->current_row_for_warning(); } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index ada09be071e..70a521696d2 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -297,7 +297,27 @@ bool select_unit::send_eof() int select_union_recursive::send_data(List<Item> &values) { - int rc= select_unit::send_data(values); + + int rc; + bool save_abort_on_warning= thd->abort_on_warning; + enum_check_fields save_count_cuted_fields= thd->count_cuted_fields; + long save_counter; + + /* + For recursive CTE's give warnings for wrong field info + However, we don't do that for CREATE TABLE ... SELECT or INSERT ... SELECT + as the upper level code for these handles setting of abort_on_warning + depending on if 'IGNORE' is used. + */ + if (thd->lex->sql_command != SQLCOM_CREATE_TABLE && + thd->lex->sql_command != SQLCOM_INSERT_SELECT) + thd->abort_on_warning= thd->is_strict_mode(); + thd->count_cuted_fields= CHECK_FIELD_WARN; + save_counter= thd->get_stmt_da()->set_current_row_for_warning(++row_counter); + rc= select_unit::send_data(values); + thd->get_stmt_da()->set_current_row_for_warning(save_counter); + thd->count_cuted_fields= save_count_cuted_fields; + thd->abort_on_warning= save_abort_on_warning; if (rc == 0 && write_err != HA_ERR_FOUND_DUPP_KEY && @@ -476,6 +496,7 @@ void select_union_recursive::cleanup() thd->rec_tables= tab; tbl->derived_result= 0; } + row_counter= 0; } diff --git a/sql/strfunc.cc b/sql/strfunc.cc index 58647c21e44..8f3ef43ba22 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -70,7 +70,7 @@ ulonglong find_set(TYPELIB *lib, const char *str, size_t length, CHARSET_INFO *c if ((mblen= cs->cset->mb_wc(cs, &wc, (const uchar *) pos, (const uchar *) end)) < 1) mblen= 1; // Not to hang on a wrong multibyte sequence - if (wc == (my_wc_t) field_separator) + else if (wc == (my_wc_t) field_separator) break; } } |