From: Michael Widenius
Date: March 10 2010 12:16am
Subject: re: Bug #44987: DELETE IGNORE and FK constraint
List-Archive: http://lists.mysql.com/internals/37792
Message-Id: <19350.58563.160692.448790@narttu.askmonty.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi!
>>>>> "Moritz" == Moritz Mertinkat writes:
Moritz> Hi everybody,
Moritz> some weeks ago I came across a problem with DELETE IGNORE while using
Moritz> foreign key constraints on MySQL 5.1.43.
Moritz> The problem is already known and has been verified, but no fix has been
Moritz> made to far: http://bugs.mysql.com/bug.php?id=44987
Moritz> I've supplied a patch (http://bugs.mysql.com/file.php?id=13943&text=1)
Moritz> which is working quite well for me but somebody with a deeper
Moritz> understanding of the code should probably double-check it.
Moritz> Unfortunately it's not assigned to anyone which is why I'm writing to
Moritz> this list :) I would really like to see this bug fixed in the next
Moritz> release even though it's only "non-critical".
Moritz> Best regards,
Moritz> Moritz
I looked at your patch and it should work ok.
However, I would replace:
bool ignore= thd->lex->current_select->no_error;
With:
bool ignore= !selext_lex->no_error;
I have now added your patch to MariaDB 5.1, with the differences that
we store warnings so that the user can see what went wrong.
The fix I used was:
+++ sql/sql_delete.cc 2010-03-10 00:13:26 +0000
@@ -335,8 +335,11 @@ bool mysql_delete(THD *thd, TABLE_LIST *
InnoDB it can fail in a FOREIGN KEY error or an
out-of-tablespace error.
*/
- error= 1;
- break;
+ if (!select_lex->no_error)
+ {
+ error= 1;
+ break;
+ }
}
}
Regards,
Monty
Check out MariaDB at http://askmonty.org