#At file:///data/z/mysql-5.1-bugteam-46425/ based on revid:kent.boortz@stripped
3203 Magne Mahre 2009-11-18
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.
modified:
mysql-test/r/delete.result
mysql-test/t/delete.test
sql/sql_delete.cc
=== modified file 'mysql-test/r/delete.result'
--- a/mysql-test/r/delete.result 2009-09-28 10:48:52 +0000
+++ b/mysql-test/r/delete.result 2009-11-18 09:32:03 +0000
@@ -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;
=== modified file 'mysql-test/t/delete.test'
--- a/mysql-test/t/delete.test 2009-09-28 10:48:52 +0000
+++ b/mysql-test/t/delete.test 2009-11-18 09:32:03 +0000
@@ -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
=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc 2009-10-16 10:29:42 +0000
+++ b/sql/sql_delete.cc 2009-11-18 09:32:03 +0000
@@ -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
Attachment: [text/bzr-bundle] bzr/magne.mahre@sun.com-20091118093203-xfet21iss71x2sya.bundle
Thread |
---|
• bzr commit into mysql-5.1-bugteam branch (magne.mahre:3203) Bug#46425 | Magne Mahre | 18 Nov |