MDEV-35307 Unexpected error WARN_SORTING_ON_TRUNCATED_LENGTH or assertion failure in diagnostics area #2
When strict mode is enabled, all warnings during `INSERT` are converted to errors regardless of their actual severity. `WARN_SORTING_ON_TRUNCATED_LENGTH` is not considered severe enough to be elevated to the ERROR level, and this commit fixes that
This commit is contained in:
parent
a4cb03ec56
commit
a914087fab
@ -513,6 +513,16 @@ select a from t1;
|
||||
a
|
||||
3
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-35307 Unexpected WARN_SORTING_ON_TRUNCATED_LENGTH or assertion
|
||||
# failure in diagnostics area #2
|
||||
#
|
||||
create table t1 (a varchar(1024)) engine=innodb;
|
||||
insert into t1 values (repeat('a',1000)),(repeat('b',1000));
|
||||
insert into t1 (a) select a from t1 order by a;
|
||||
Warnings:
|
||||
Warning 4202 2 values were longer than max_sort_length. Sorting used only the first 70 bytes
|
||||
drop table t1;
|
||||
connection default;
|
||||
disconnect test_con1;
|
||||
disconnect test_con2;
|
||||
|
@ -303,6 +303,19 @@ select a from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35307 Unexpected WARN_SORTING_ON_TRUNCATED_LENGTH or assertion
|
||||
--echo # failure in diagnostics area #2
|
||||
--echo #
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
create table t1 (a varchar(1024)) engine=innodb;
|
||||
insert into t1 values (repeat('a',1000)),(repeat('b',1000));
|
||||
insert into t1 (a) select a from t1 order by a;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
|
@ -8632,6 +8632,32 @@ error:
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Push post-execution warnings, which may be some kinds of aggregate messages
|
||||
like number of times max_sort_length was reached during sorting/grouping
|
||||
*/
|
||||
void THD::push_final_warnings()
|
||||
{
|
||||
if (num_of_strings_sorted_on_truncated_length)
|
||||
{
|
||||
/*
|
||||
WARN_SORTING_ON_TRUNCATED_LENGTH is not considered important enough to be
|
||||
elevated to the ERROR level, so reset abort_on_warning flag before pushing
|
||||
*/
|
||||
bool saved_abort_on_warning= abort_on_warning;
|
||||
abort_on_warning= false;
|
||||
push_warning_printf(this, Sql_condition::WARN_LEVEL_WARN,
|
||||
WARN_SORTING_ON_TRUNCATED_LENGTH,
|
||||
ER_THD(this, WARN_SORTING_ON_TRUNCATED_LENGTH),
|
||||
num_of_strings_sorted_on_truncated_length,
|
||||
variables.max_sort_length);
|
||||
num_of_strings_sorted_on_truncated_length= 0;
|
||||
abort_on_warning= saved_abort_on_warning;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AUTHID::copy(MEM_ROOT *mem_root, const LEX_CSTRING *user_name,
|
||||
const LEX_CSTRING *host_name)
|
||||
{
|
||||
|
@ -6067,23 +6067,7 @@ public:
|
||||
bool need_report_unit_results();
|
||||
bool report_collected_unit_results();
|
||||
bool init_collecting_unit_results();
|
||||
|
||||
/*
|
||||
Push post-execution warnings, which may be some kinds of aggregate messages
|
||||
like number of times max_sort_length was reached during sorting/grouping
|
||||
*/
|
||||
void push_final_warnings()
|
||||
{
|
||||
if (num_of_strings_sorted_on_truncated_length)
|
||||
{
|
||||
push_warning_printf(this, Sql_condition::WARN_LEVEL_WARN,
|
||||
WARN_SORTING_ON_TRUNCATED_LENGTH,
|
||||
ER_THD(this, WARN_SORTING_ON_TRUNCATED_LENGTH),
|
||||
num_of_strings_sorted_on_truncated_length,
|
||||
variables.max_sort_length);
|
||||
num_of_strings_sorted_on_truncated_length= 0;
|
||||
}
|
||||
}
|
||||
void push_final_warnings();
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user