Commit d36cd5f0 authored by Rucha Deodhar's avatar Rucha Deodhar

MDEV-17729: Assertion `! is_set() || m_can_overwrite_status' failed in

Diagnostics_area::set_error_status

Analysis: When strict mode is enabled, all warnings are converted to errors
including those which do not occur because of bad data.
Fix: Query should not be aborted when we have warning because limit to
examine rows was reached because it doesn't happen due to bad data.
So thd->abort_on_warning should be false.
parent 3e807d25
...@@ -853,3 +853,18 @@ Warnings: ...@@ -853,3 +853,18 @@ Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete. Warning 1931 Query execution was interrupted. The query examined at least 22 rows, which exceeds LIMIT ROWS EXAMINED (21). The query result may be incomplete.
drop view v; drop view v;
drop table t1, t2; drop table t1, t2;
#
# 10.1 Test
#
# MDEV-17729: Assertion `! is_set() || m_can_overwrite_status'
# failed in Diagnostics_area::set_error_status
#
set @old_mode= @@sql_mode;
CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,k INT, c CHAR(20));
INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0');
SET @@sql_mode='STRICT_TRANS_TABLES';
INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 4 rows, which exceeds LIMIT ROWS EXAMINED (2). The query result may be incomplete.
SET @@sql_mode=@old_mode;
DROP TABLE t1;
...@@ -576,3 +576,20 @@ EXECUTE ps; ...@@ -576,3 +576,20 @@ EXECUTE ps;
drop view v; drop view v;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # 10.1 Test
--echo #
--echo # MDEV-17729: Assertion `! is_set() || m_can_overwrite_status'
--echo # failed in Diagnostics_area::set_error_status
--echo #
set @old_mode= @@sql_mode;
CREATE TABLE t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,k INT, c CHAR(20));
INSERT INTO t1 (k,c) VALUES(0,'0'), (0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0'),(0,'0');
SET @@sql_mode='STRICT_TRANS_TABLES';
INSERT INTO t1 (c) SELECT k FROM t1 LIMIT ROWS EXAMINED 2;
SET @@sql_mode=@old_mode;
DROP TABLE t1;
...@@ -399,11 +399,14 @@ bool handle_select(THD *thd, LEX *lex, select_result *result, ...@@ -399,11 +399,14 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
If LIMIT ROWS EXAMINED interrupted query execution, issue a warning, If LIMIT ROWS EXAMINED interrupted query execution, issue a warning,
continue with normal processing and produce an incomplete query result. continue with normal processing and produce an incomplete query result.
*/ */
bool saved_abort_on_warning= thd->abort_on_warning;
thd->abort_on_warning= false;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT, ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT,
ER_THD(thd, ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT), ER_THD(thd, ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
thd->accessed_rows_and_keys, thd->accessed_rows_and_keys,
thd->lex->limit_rows_examined->val_uint()); thd->lex->limit_rows_examined->val_uint());
thd->abort_on_warning= saved_abort_on_warning;
thd->reset_killed(); thd->reset_killed();
} }
/* Disable LIMIT ROWS EXAMINED after query execution. */ /* Disable LIMIT ROWS EXAMINED after query execution. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment