summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-08-10 13:06:08 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-08-10 13:06:08 +0200
commitc442e1ae21edc1f63906ac6101f1e989b589846f (patch)
treec98e223d5236f0e189104121fa96c591b05f1bd6 /sql
parent4f54c219e7c73072d7eff1e81e0f51dc1ff47509 (diff)
parent1ac0bce36e5bf2136cedb1ce1da949f53cce4404 (diff)
downloadmariadb-git-c442e1ae21edc1f63906ac6101f1e989b589846f.tar.gz
Merge branch '10.5' into 10.6
Diffstat (limited to 'sql')
-rw-r--r--sql/item_jsonfunc.cc4
-rw-r--r--sql/item_strfunc.cc1
-rw-r--r--sql/mysqld.cc8
-rw-r--r--sql/sql_cache.cc6
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_error.h10
-rw-r--r--sql/sql_union.cc23
-rw-r--r--sql/strfunc.cc2
8 files changed, 45 insertions, 13 deletions
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 197a4b12907..3c2787cb799 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -2681,10 +2681,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 00ddee4ac4b..07eff218aa3 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -4317,6 +4317,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 b6759452893..d310d8dcf9b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4248,15 +4248,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 646544c12fe..56a443bacc4 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 d9e56ed5e5b..cb58aff5c3e 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -6509,10 +6509,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 6b0d4d7749c..8c0deb5e172 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; }
@@ -1137,6 +1144,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 a0f60532f32..e8bdbcba2f2 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -251,7 +251,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 &&
@@ -918,6 +938,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 9f178950fb0..416aea589dd 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -72,7 +72,7 @@ ulonglong find_set(const TYPELIB *lib,
if ((mblen= cs->mb_wc(&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;
}
}