Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.4.31, 10.11.4
-
MySQL version: 10.11.4-MariaDB-1:10.11.4+maria~ubu2204 through PHP extension MySQLi
Description
The following INSERT IGNORE emits an error instead of a warning:
DROP TABLE IF EXISTS `my_table`;
CREATE TABLE `my_table` (
`first_col` char(63),
`second_col` char(63),
constraint `my_const` check (`first_col` != `second_col`)
);INSERT IGNORE INTO `my_table` VALUES ('a', 'a');
Attachments
Issue Links
- relates to
-
MDEV-31985 IGNORE in INSERT and LOAD are being ignored in InnoDB bulk insert
-
- Confirmed
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
The following INSERT IGNORE emits an error instead of a warning:
{{DROP TABLE IF EXISTS `my_table`; CREATE TABLE `my_table` ( `first_col` char(63), `second_col` char(63), constraint `my_const` check (`first_col` != `second_col`) ); INSERT IGNORE INTO `my_table` VALUES ('a', 'a');}} |
The following INSERT IGNORE emits an error instead of a warning:
{{ DROP TABLE IF EXISTS `my_table`; CREATE TABLE `my_table` ( `first_col` char(63), `second_col` char(63), constraint `my_const` check (`first_col` != `second_col`) ); INSERT IGNORE INTO `my_table` VALUES ('a', 'a'); }} |
Description |
The following INSERT IGNORE emits an error instead of a warning:
{{ DROP TABLE IF EXISTS `my_table`; CREATE TABLE `my_table` ( `first_col` char(63), `second_col` char(63), constraint `my_const` check (`first_col` != `second_col`) ); INSERT IGNORE INTO `my_table` VALUES ('a', 'a'); }} |
The following INSERT IGNORE emits an error instead of a warning:
DROP TABLE IF EXISTS `my_table`; CREATE TABLE `my_table` ( `first_col` char(63), `second_col` char(63), constraint `my_const` check (`first_col` != `second_col`) ); INSERT IGNORE INTO `my_table` VALUES ('a', 'a'); |
Description |
The following INSERT IGNORE emits an error instead of a warning:
DROP TABLE IF EXISTS `my_table`; CREATE TABLE `my_table` ( `first_col` char(63), `second_col` char(63), constraint `my_const` check (`first_col` != `second_col`) ); INSERT IGNORE INTO `my_table` VALUES ('a', 'a'); |
The following {{INSERT IGNORE}} emits an error instead of a warning:
{quote} DROP TABLE IF EXISTS `my_table`; CREATE TABLE `my_table` ( `first_col` char(63), `second_col` char(63), constraint `my_const` check (`first_col` != `second_col`) ); INSERT IGNORE INTO `my_table` VALUES ('a', 'a'); {quote} |
Assignee | Oleksandr Byelkin [ sanja ] |
Labels | regression |
Summary | The IGNORE in INSERT IGNORE is ignored in v10.11.4 | INSERT IGNORE on constraints result in ERROR rather than warning |
Affects Version/s | 10.4.31 [ 29010 ] |
Assignee | Oleksandr Byelkin [ sanja ] | Daniel Black [ danblack ] |
Fix Version/s | 10.4 [ 22408 ] |
Status | Open [ 1 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Labels | compat80 |
Assignee | Daniel Black [ danblack ] | Michael Widenius [ monty ] |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.10 [ 27530 ] | |
Fix Version/s | 10.11 [ 27614 ] | |
Fix Version/s | 11.0 [ 28320 ] | |
Fix Version/s | 11.1 [ 28549 ] | |
Fix Version/s | 11.2 [ 28603 ] |
Assignee | Michael Widenius [ monty ] | Daniel Black [ danblack ] |
Fix Version/s | 11.4 [ 29301 ] | |
Fix Version/s | 10.4 [ 22408 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.10 [ 27530 ] | |
Fix Version/s | 10.11 [ 27614 ] | |
Fix Version/s | 11.0 [ 28320 ] | |
Fix Version/s | 11.1 [ 28549 ] | |
Fix Version/s | 11.2 [ 28603 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
issue.field.resolutiondate | 2023-11-14 05:29:03.0 | 2023-11-14 05:29:02.801 |
Component/s | Data Manipulation - Insert [ 10101 ] | |
Fix Version/s | 11.4.1 [ 29523 ] | |
Fix Version/s | 11.4 [ 29301 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Link | This issue relates to MDEV-31985 [ MDEV-31985 ] |
I checked some earlier versions https://dbfiddle.uk/H9aZj6Y9 and it seems it was always causing an error, so I don't think its a regression.
It seems the KB document https://mariadb.com/kb/en/insert-ignore/ inconsistent as looking at documentation this only applies to this list of errors is ignored.
error generated
ERROR 4025 (23000): CONSTRAINT `my_const` failed for `test`.`my_table`
It does seem rather inconsistent to not insert on a FK constraint, but error on a local constraint.
I tested a fix:
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1129,10 +1129,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
}
}
- (values_list.elements == 1 ?
- 0 :
VIEW_CHECK_SKIP)
The reason for this check was added in 2aad30394d33eef23545d717f4b92eb280c2b19d around views with WITH CHECK OPTION.
mysql_load and mysql_updates (from LOAD DATA and UPDATE) just pass with lex.ignore to view_check_option.
Sanja, why is the insert behaviour different?
Why does it error rather than warn if one value provided, by two will ignore?