crash if JOIN::optimize fails in INSERT IGNORE
Bug #886146 reported by
Sergei Golubchik
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Confirmed
|
Undecided
|
Unassigned | ||
5.5 |
New
|
Undecided
|
Unassigned |
Bug Description
See MySQL's Bug#34660.
The fix isn't quite complete, the crash can occur even without subqueries. Doing
INSERT IGNORE ... SELECT ...
and imitating a failure in JOIN::optimize (forcing table->
the error status is properly returned all the way up to mysql_parse, but the error packet is not sent
(see my_message_sql() in 5.3) because of the IGNORE clause.
Changed in maria: | |
status: | New → Confirmed |
To post a comment you must log in.
Monty thinks that my_message_sql should not check for select_ lex->no_ errors and always send an error packet.
Trying it, mysql-test fails in three different ways (because of errors that were not happening before):
1. INSERT IGNORE ... SELECT: ERROR 1048: Column 'c1' cannot be null
This can be fixed with
=== modified file 'sql/sql_insert.cc' insert: :send_data( List<Item>
--- sql/sql_insert.cc 2011-09-26 20:54:00 +0000
+++ sql/sql_insert.cc 2011-11-04 14:02:57 +0000
@@ -3271,7 +3271,8 @@ int select_
thd- >count_ cuted_fields= CHECK_FIELD_WARN; // Calculate cuted fields values( values) ; cuted_fields= CHECK_FIELD_ ERROR_FOR_ NULL; cuted_fields= CHECK_FIELD_ ERROR_FOR_ NULL; >auto_increment _field_ not_null= FALSE;
store_
- thd->count_
+ if (!info.ignore)
+ thd->count_
if (thd->is_error())
{
table-
2. UPDATE IGNORE T1 SET B=(SELECT ...) ERROR 1242: Subquery returns more than 1 row
In my opinion this needs no fix. It correctly fails as it should. This error
should not be ignored.
3. DELETE IGNORE ... ERROR 1451: Cannot delete or update a parent row: a foreign key constraint fails
This one is a bit more difficult to fix.