This script:
SET sql_mode=DEFAULT;
|
CREATE OR REPLACE TABLE t1 (a TEXT);
|
PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (2||3)';
|
EXECUTE stmt;
|
|
SET sql_mode=ORACLE;
|
EXECUTE stmt;
|
|
ALTER TABLE t1 ADD b INT;
|
EXECUTE stmt;
|
|
SELECT * FROM t1;
|
returns:
+------+------+
|
| a | b |
|
+------+------+
|
| 1 | NULL |
|
| 1 | NULL |
|
| 23 | NULL |
|
+------+------+
|
Notice, changing sql_mode between EXECUTE and PREPARE does not change the result, || is still treated as boolean OR in the second EXECUTE. However, as soon as I do ALTER TABLE, it forces automatic statement repreparation and the meaning of || in the third EXECUTE changes to concatenation.
This should be fixed to remember sql_mode with the prepared statement, so when the automatic repreparation happens it uses the same sql_mode which was used during PREPARE.
- blocks
-
MDEV-11880
sql_mode=ORACLE: Make the concatenation operator ignore NULL arguments
-
-
Closed
{"report":{"fcp":859.7000007629395,"ttfb":170.20000076293945,"pageVisibility":"visible","entityId":59887,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"daae7ca7-6a67-400c-9b4b-a0a5f1342d86","navigationType":0,"readyForUser":917,"redirectCount":0,"resourceLoadedEnd":983.2000007629395,"resourceLoadedStart":175.9000005722046,"resourceTiming":[{"duration":211,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":175.9000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":175.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":386.9000005722046,"responseStart":0,"secureConnectionStart":0},{"duration":210.69999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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","startTime":176.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":176.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":387,"responseStart":0,"secureConnectionStart":0},{"duration":220.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":176.30000019073486,"connectEnd":176.30000019073486,"connectStart":176.30000019073486,"domainLookupEnd":176.30000019073486,"domainLookupStart":176.30000019073486,"fetchStart":176.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":176.30000019073486,"responseEnd":397.1000003814697,"responseStart":397.1000003814697,"secureConnectionStart":176.30000019073486},{"duration":289.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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","startTime":176.5,"connectEnd":176.5,"connectStart":176.5,"domainLookupEnd":176.5,"domainLookupStart":176.5,"fetchStart":176.5,"redirectEnd":0,"redirectStart":0,"requestStart":176.5,"responseEnd":466.1000003814697,"responseStart":466.1000003814697,"secureConnectionStart":176.5},{"duration":293.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":176.60000038146973,"connectEnd":176.60000038146973,"connectStart":176.60000038146973,"domainLookupEnd":176.60000038146973,"domainLookupStart":176.60000038146973,"fetchStart":176.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":176.60000038146973,"responseEnd":469.70000076293945,"responseStart":469.70000076293945,"secureConnectionStart":176.60000038146973},{"duration":293.5999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":176.70000076293945,"connectEnd":176.70000076293945,"connectStart":176.70000076293945,"domainLookupEnd":176.70000076293945,"domainLookupStart":176.70000076293945,"fetchStart":176.70000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":176.70000076293945,"responseEnd":470.30000019073486,"responseStart":470.30000019073486,"secureConnectionStart":176.70000076293945},{"duration":294,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":176.80000019073486,"connectEnd":176.80000019073486,"connectStart":176.80000019073486,"domainLookupEnd":176.80000019073486,"domainLookupStart":176.80000019073486,"fetchStart":176.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":176.80000019073486,"responseEnd":470.80000019073486,"responseStart":470.80000019073486,"secureConnectionStart":176.80000019073486},{"duration":294.30000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":176.9000005722046,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":176.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":471.20000076293945,"responseStart":0,"secureConnectionStart":0},{"duration":294.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":177,"connectEnd":177,"connectStart":177,"domainLookupEnd":177,"domainLookupStart":177,"fetchStart":177,"redirectEnd":0,"redirectStart":0,"requestStart":177,"responseEnd":471.30000019073486,"responseStart":471.30000019073486,"secureConnectionStart":177},{"duration":295,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":177.20000076293945,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":177.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":472.20000076293945,"responseStart":0,"secureConnectionStart":0},{"duration":295,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":177.30000019073486,"connectEnd":177.30000019073486,"connectStart":177.30000019073486,"domainLookupEnd":177.30000019073486,"domainLookupStart":177.30000019073486,"fetchStart":177.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":177.30000019073486,"responseEnd":472.30000019073486,"responseStart":472.30000019073486,"secureConnectionStart":177.30000019073486},{"duration":393,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":178.10000038146973,"connectEnd":178.10000038146973,"connectStart":178.10000038146973,"domainLookupEnd":178.10000038146973,"domainLookupStart":178.10000038146973,"fetchStart":178.10000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":178.10000038146973,"responseEnd":571.1000003814697,"responseStart":571.1000003814697,"secureConnectionStart":178.10000038146973},{"duration":805,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":178.20000076293945,"connectEnd":178.20000076293945,"connectStart":178.20000076293945,"domainLookupEnd":178.20000076293945,"domainLookupStart":178.20000076293945,"fetchStart":178.20000076293945,"redirectEnd":0,"redirectStart":0,"requestStart":178.20000076293945,"responseEnd":983.2000007629395,"responseStart":983.2000007629395,"secureConnectionStart":178.20000076293945},{"duration":320.8999996185303,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":613.6000003814697,"connectEnd":613.6000003814697,"connectStart":613.6000003814697,"domainLookupEnd":613.6000003814697,"domainLookupStart":613.6000003814697,"fetchStart":613.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":613.6000003814697,"responseEnd":934.5,"responseStart":934.5,"secureConnectionStart":613.6000003814697}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":21,"responseStart":170,"responseEnd":171,"domLoading":173,"domInteractive":999,"domContentLoadedEventStart":999,"domContentLoadedEventEnd":1034,"domComplete":1862,"loadEventStart":1862,"loadEventEnd":1864,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":986.7000007629395},{"name":"bigPipe.sidebar-id.end","time":987.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":987.6000003814697},{"name":"bigPipe.activity-panel-pipe-id.end","time":990},{"name":"activityTabFullyLoaded","time":1042.1000003814697}],"measures":[],"correlationId":"7c01b5404d8041","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":89,"dbReadsTimeInMs":12,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}