diff --git a/mysql-test/r/filesort_debug.result b/mysql-test/r/filesort_debug.result index 703ae999c64..13912ac8756 100644 --- a/mysql-test/r/filesort_debug.result +++ b/mysql-test/r/filesort_debug.result @@ -7,7 +7,7 @@ INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5); SET session debug_dbug= '+d,alloc_sort_buffer_fail'; CALL mtr.add_suppression("Out of sort memory"); SELECT * FROM t1 ORDER BY f1 ASC, f0; -Got one of the listed errors +ERROR HY001: Out of sort memory, consider increasing server sort buffer size SET session debug_dbug= @old_debug; CREATE FUNCTION f1() RETURNS INT RETURN 1; DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1; diff --git a/mysql-test/t/filesort_debug.test b/mysql-test/t/filesort_debug.test index bf9e9ca3ed2..c375334ad29 100644 --- a/mysql-test/t/filesort_debug.test +++ b/mysql-test/t/filesort_debug.test @@ -13,7 +13,7 @@ INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5); SET session debug_dbug= '+d,alloc_sort_buffer_fail'; CALL mtr.add_suppression("Out of sort memory"); ---error ER_OUT_OF_SORTMEMORY,ER_OUT_OF_RESOURCES +--error ER_OUT_OF_SORTMEMORY SELECT * FROM t1 ORDER BY f1 ASC, f0; SET session debug_dbug= @old_debug; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c38beb8e122..ed394641739 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1202,18 +1202,6 @@ Sql_condition* THD::raise_condition(uint sql_errno, if (handle_condition(sql_errno, sqlstate, level, msg, &cond)) DBUG_RETURN(cond); - /* - Avoid pushing a condition for fatal out of memory errors as this will - require memory allocation and therefore might fail. Non fatal out of - memory errors can occur if raised by SIGNAL/RESIGNAL statement. - */ - if (!(is_fatal_error && (sql_errno == EE_OUTOFMEMORY || - sql_errno == ER_OUTOFMEMORY))) - { - cond= da->push_warning(this, sql_errno, sqlstate, level, msg); - } - - if (level == Sql_condition::WARN_LEVEL_ERROR) { is_slave_error= 1; // needed to catch query errors during replication @@ -1227,6 +1215,16 @@ Sql_condition* THD::raise_condition(uint sql_errno, query_cache_abort(&query_cache_tls); + /* + Avoid pushing a condition for fatal out of memory errors as this will + require memory allocation and therefore might fail. Non fatal out of + memory errors can occur if raised by SIGNAL/RESIGNAL statement. + */ + if (!(is_fatal_error && (sql_errno == EE_OUTOFMEMORY || + sql_errno == ER_OUTOFMEMORY))) + { + cond= da->push_warning(this, sql_errno, sqlstate, level, msg); + } DBUG_RETURN(cond); }