With "INSERT IGNORE", the INSERT executes successfully even though there is a NOT NULL constraint on column c1.
In transaction, although the UPDATE executes unsuccessfully and reports an error, it locks the records and blocks other transaction.
/* init */ CREATE TABLE t(c1 BLOB NOT NULL, c2 TEXT);
|
/* init */ INSERT IGNORE INTO t VALUES (NULL, NULL), (NULL, 'aaa');
|
/* t1 */ BEGIN;
|
/* t1 */ UPDATE t SET c2='test' WHERE c1;
|
/* t1 */ ERROR 1292 (22007): Truncated incorrect DOUBLE value: ''
|
/* t2 */ BEGIN;
|
/* t2 */ UPDATE t SET c2 = 'def'; -- t2 is blocked
|
/* t1 */ COMMIT; -- t2 is unblocked
|
/* t2 */ COMMIT;
|
{"report":{"fcp":3000.4000000953674,"ttfb":496.90000009536743,"pageVisibility":"visible","entityId":108742,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"d324b0e9-ace4-4fc8-acd9-16e3a7e2d32e","navigationType":0,"readyForUser":3015.5,"redirectCount":0,"resourceLoadedEnd":2955.5,"resourceLoadedStart":618.4000000953674,"resourceTiming":[{"duration":994.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":618.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":618.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1613.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":994.9000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":618.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":618.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1613.5,"responseStart":0,"secureConnectionStart":0},{"duration":1004.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":618.9000000953674,"connectEnd":618.9000000953674,"connectStart":618.9000000953674,"domainLookupEnd":618.9000000953674,"domainLookupStart":618.9000000953674,"fetchStart":618.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":618.9000000953674,"responseEnd":1623.0999999046326,"responseStart":1623.0999999046326,"secureConnectionStart":618.9000000953674},{"duration":1105.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":619.0999999046326,"connectEnd":619.0999999046326,"connectStart":619.0999999046326,"domainLookupEnd":619.0999999046326,"domainLookupStart":619.0999999046326,"fetchStart":619.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":619.0999999046326,"responseEnd":1724.8000001907349,"responseStart":1724.8000001907349,"secureConnectionStart":619.0999999046326},{"duration":1184.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":619.4000000953674,"connectEnd":619.4000000953674,"connectStart":619.4000000953674,"domainLookupEnd":619.4000000953674,"domainLookupStart":619.4000000953674,"fetchStart":619.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":619.4000000953674,"responseEnd":1803.9000000953674,"responseStart":1803.9000000953674,"secureConnectionStart":619.4000000953674},{"duration":1242.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":619.5999999046326,"connectEnd":619.5999999046326,"connectStart":619.5999999046326,"domainLookupEnd":619.5999999046326,"domainLookupStart":619.5999999046326,"fetchStart":619.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":619.5999999046326,"responseEnd":1862.4000000953674,"responseStart":1862.4000000953674,"secureConnectionStart":619.5999999046326},{"duration":1327.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":619.6999998092651,"connectEnd":619.6999998092651,"connectStart":619.6999998092651,"domainLookupEnd":619.6999998092651,"domainLookupStart":619.6999998092651,"fetchStart":619.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":619.6999998092651,"responseEnd":1947.5,"responseStart":1947.5,"secureConnectionStart":619.6999998092651},{"duration":2044.7999997138977,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":619.9000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":619.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2664.699999809265,"responseStart":0,"secureConnectionStart":0},{"duration":1328.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":620.0999999046326,"connectEnd":620.0999999046326,"connectStart":620.0999999046326,"domainLookupEnd":620.0999999046326,"domainLookupStart":620.0999999046326,"fetchStart":620.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":620.0999999046326,"responseEnd":1948.1999998092651,"responseStart":1948.0999999046326,"secureConnectionStart":620.0999999046326},{"duration":2044.7000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":620.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":620.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2664.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":1368,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":620.4000000953674,"connectEnd":620.4000000953674,"connectStart":620.4000000953674,"domainLookupEnd":620.4000000953674,"domainLookupStart":620.4000000953674,"fetchStart":620.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":620.4000000953674,"responseEnd":1988.4000000953674,"responseStart":1988.4000000953674,"secureConnectionStart":620.4000000953674},{"duration":2097.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":621.1999998092651,"connectEnd":621.1999998092651,"connectStart":621.1999998092651,"domainLookupEnd":621.1999998092651,"domainLookupStart":621.1999998092651,"fetchStart":621.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":621.1999998092651,"responseEnd":2718.4000000953674,"responseStart":2718.300000190735,"secureConnectionStart":621.1999998092651},{"duration":2334.199999809265,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":621.3000001907349,"connectEnd":621.3000001907349,"connectStart":621.3000001907349,"domainLookupEnd":621.3000001907349,"domainLookupStart":621.3000001907349,"fetchStart":621.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":621.3000001907349,"responseEnd":2955.5,"responseStart":2955.4000000953674,"secureConnectionStart":621.3000001907349},{"duration":421.2000002861023,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1905.0999999046326,"connectEnd":1905.0999999046326,"connectStart":1905.0999999046326,"domainLookupEnd":1905.0999999046326,"domainLookupStart":1905.0999999046326,"fetchStart":1905.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":1905.0999999046326,"responseEnd":2326.300000190735,"responseStart":2326.300000190735,"secureConnectionStart":1905.0999999046326},{"duration":433.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":2673,"connectEnd":2673,"connectStart":2673,"domainLookupEnd":2673,"domainLookupStart":2673,"fetchStart":2673,"redirectEnd":0,"redirectStart":0,"requestStart":2673,"responseEnd":3106.5999999046326,"responseStart":3106.5999999046326,"secureConnectionStart":2673}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":158,"responseStart":497,"responseEnd":499,"domLoading":504,"domInteractive":3077,"domContentLoadedEventStart":3077,"domContentLoadedEventEnd":3126,"domComplete":3534,"loadEventStart":3534,"loadEventEnd":3534,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":3056.5},{"name":"bigPipe.sidebar-id.end","time":3057.9000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":3058.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":3061.0999999046326},{"name":"activityTabFullyLoaded","time":3141.199999809265}],"measures":[],"correlationId":"2cdb1688575ce9","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":106,"dbReadsTimeInMs":16,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Yes, INSERT IGNORE is supposed to ‘fix’ errors by replacing garbage with some other garbage. It is working as designed when it replaces the NULL values with the implicit default value of the NOT NULL column, in this case the empty string.
Here is an mtr version of the test, replacing the INSERT IGNORE with an equivalent plain INSERT. By the way,
MDEV-27025orMDEV-27992is not playing any role here:--source include/have_innodb.inc
--error ER_TRUNCATED_WRONG_VALUE
let $wait_condition=
--source include/wait_condition.inc
reap;
disconnect con2;
The error message confused me at first. But, it turns out that WHERE apparently expects a DOUBLE expression here, or something that can ultimately be interpreted as Boolean. The error message is about converting the value '' of the column c1 to a numeric expression. I would guess that in a non-strict sql_mode, the empty string should be equivalent to 0, which in turn is equivalent to false. The MariaDB data type system does not include a Boolean data type.
I think that this is working as designed. The error during the UPDATE execution is not a fatal one that would force the transaction to be aborted. The transaction will continue to hold some locks. Examples of errors that cause a transaction abort would be a deadlock, and in some cases, a lock wait timeout.
If you think that something should be fixed, please describe it in more detail. I do not defend the current design. I think that we must avoid changes that could break compatibility with existing applications. I guess that it is the reason why MariaDB has retained the INSERT IGNORE syntax.