IGNORE option tells the server to ignore some common errors.
IGNORE can be used with the following statements:
The logic used:
- Variables out of ranges are replaced with the maximum/minimum value.
NOT NULLfield will insert 0 ( in a numerical field), 0000-00-00 ( in a date field) or an empty string ( in a character field).
- Rows that cause a duplicate key error or break a foreign key constraint are not inserted, updated, or deleted.
The following errors are ignored:
|Error number||Symbolic error name||Description|
|Can't write; duplicate key in table 'xxx'"|
|Column 'xxx' cannot be null|
|Subquery returns more than 1 row|
|Out of range value for column 'xxx'|
| ||Data truncated for column 'xxx'|
|Incorrect date value: 'xxx'|
|Incorrect integer value|
|Cannot delete or update a parent row|
Ignored errors normally generate a warning.
A property of the
IGNORE clause consists in causing transactional engines and non-transactional engines (like XtraDB and Aria) to behave the same way. For example, normally a multi-row insert which tries to violate a
UNIQUE contraint is completely rolled back on XtraDB/InnoDB, but might be partially executed on Aria. With the
IGNORE clause, the statement will be partially executed in both engines.