Commit 9e6cb377 authored by Magne Mahre's avatar Magne Mahre

Bug #46425 crash in Diagnostics_area::set_ok_status , empty statement,

           DELETE IGNORE

The ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG error was set in the
diagnostics area when it happened, but the DELETE cleanup code
never checked for a non-fatal error condition, thus trying to
set diag.area to "ok".  This triggered an assert checking that
the diag.area was empty.

The fix was to test if there existed a non-fatal error condition
(thd->is_error() before ok'ing the operation.
parent 33025aba
......@@ -324,3 +324,16 @@ a
1
2
DROP TABLE t1, t2, t3;
#
# Bug #46425 crash in Diagnostics_area::set_ok_status,
# empty statement, DELETE IGNORE
#
CREATE table t1 (i INTEGER);
INSERT INTO t1 VALUES (1);
CREATE TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
INSERT INTO t1 SELECT * FROM t1 AS A;
END |
DELETE IGNORE FROM t1;
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
DROP TABLE t1;
......@@ -336,3 +336,25 @@ SELECT * FROM t2;
SELECT * FROM t3;
DROP TABLE t1, t2, t3;
--echo #
--echo # Bug #46425 crash in Diagnostics_area::set_ok_status,
--echo # empty statement, DELETE IGNORE
--echo #
CREATE table t1 (i INTEGER);
INSERT INTO t1 VALUES (1);
--delimiter |
CREATE TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
BEGIN
INSERT INTO t1 SELECT * FROM t1 AS A;
END |
--delimiter ;
--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
DELETE IGNORE FROM t1;
DROP TABLE t1;
\ No newline at end of file
......@@ -426,7 +426,8 @@ cleanup:
}
DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex);
if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error))
if (error < 0 ||
(thd->lex->ignore && !thd->is_error() && !thd->is_fatal_error))
{
/*
If a TRUNCATE TABLE was issued, the number of rows should be reported as
......
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