Type:
Bug
Priority:
Critical
Resolution:
Fixed
Affects Version/s:
5.5.33a , 5.3.13 , 5.5(EOL) , 10.0(EOL) , 10.1(EOL)
Test Case:
CREATE TABLE `testing` (
`datas` VARCHAR (25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `testing` VALUES ( '1,2' ), ( '2,3' ), ( '3,4' );
Shows issue -- See last row
SELECT IF (FIND_IN_SET( '1' , `datas`), 1.5, IF (FIND_IN_SET( '2' , `datas`), 2, NULL )) AS ` First `, '1' AS ` Second `, '2' AS `Third` FROM `testing`;
+ -------+--------+-------+
| First | Second | Third |
+ -------+--------+-------+
| 1.5 | 1 | 2 |
| 2.0 | 1 | 2 |
| 0.0 | NULL | 1 |
+ -------+--------+-------+
SELECT IF (FIND_IN_SET( '1' , `datas`), 1, IF (FIND_IN_SET( '2' , `datas`), 2.5, IF (FIND_IN_SET( '5' , `datas`), 5, NULL ))) AS ` First `, '1' AS ` Second `, '2' AS `Third` FROM `testing`;
+ -------+--------+-------+
| First | Second | Third |
+ -------+--------+-------+
| 1.0 | 1 | 2 |
| 2.5 | 1 | 2 |
| 0.0 | NULL | 1 |
+ -------+--------+-------+
Works as expected
SELECT IF (FIND_IN_SET( '1' , `datas`), '1.5' , IF (FIND_IN_SET( '2' , `datas`), 2, NULL )) AS ` First `, '1' AS ` Second `, '2' AS `Third` FROM `testing`;
+ -------+--------+-------+
| First | Second | Third |
+ -------+--------+-------+
| 1.5 | 1 | 2 |
| 2 | 1 | 2 |
| NULL | 1 | 2 |
+ -------+--------+-------+
SELECT IF (FIND_IN_SET( '1' , `datas`), 1, IF (FIND_IN_SET( '2' , `datas`), 2, NULL )) AS ` First `, '1' AS ` Second `, '2' AS `Third` FROM `testing`;
+ -------+--------+-------+
| First | Second | Third |
+ -------+--------+-------+
| 1 | 1 | 2 |
| 2 | 1 | 2 |
| NULL | 1 | 2 |
+ -------+--------+-------+
The issue is that when an IF statement returns a NULL value and there's a decimal value being returned for one of the upstream IF options then the IF is returning a 0.0 value as well as the expected NULL and therefore causing all further values to be shifted to the next column.
If I change the decimal to a string or an integer, then the expected data is returned as shown in the last two SELECT statements.
I've tested using MyISAM and InnoDB and it happens to both. I tested and confirmed this happens on MariaDB version "10.0.21-MariaDB-log". This issue does not happen on version "5.5.32-MariaDB-log". It does not happen on 5.6.26 MySQL Community Server (GPL) either.
{"report":{"fcp":1274.300000000745,"ttfb":209.59999999962747,"pageVisibility":"visible","entityId":52773,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"90917efb-f3d5-4867-be67-8bcf85cbe3c3","navigationType":0,"readyForUser":1371,"redirectCount":0,"resourceLoadedEnd":1576.4000000003725,"resourceLoadedStart":216.40000000037253,"resourceTiming":[{"duration":519.3000000007451,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":216.40000000037253,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":216.40000000037253,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":735.7000000011176,"responseStart":0,"secureConnectionStart":0},{"duration":519.3999999985099,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":216.7000000011176,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":216.7000000011176,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":736.0999999996275,"responseStart":0,"secureConnectionStart":0},{"duration":528.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/e9b27a47da5fb0f74a35acd57e9847fb-CDN/lu2bv2/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":216.90000000037253,"connectEnd":216.90000000037253,"connectStart":216.90000000037253,"domainLookupEnd":216.90000000037253,"domainLookupStart":216.90000000037253,"fetchStart":216.90000000037253,"redirectEnd":0,"redirectStart":0,"requestStart":216.90000000037253,"responseEnd":745.4000000003725,"responseStart":745.4000000003725,"secureConnectionStart":216.90000000037253},{"duration":599.4000000003725,"initiatorType":"script","name":"https://jira.mariadb.org/s/c32eb0da7ad9831253f8397e6cc26afd-CDN/lu2bv2/820016/12ta74/2380add21a9a1006587582385952de73/_/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":217.09999999962747,"connectEnd":217.09999999962747,"connectStart":217.09999999962747,"domainLookupEnd":217.09999999962747,"domainLookupStart":217.09999999962747,"fetchStart":217.09999999962747,"redirectEnd":0,"redirectStart":0,"requestStart":217.09999999962747,"responseEnd":816.5,"responseStart":816.5,"secureConnectionStart":217.09999999962747},{"duration":603,"initiatorType":"script","name":"https://jira.mariadb.org/s/bc0bcb146314416123c992714ee00ff7-CDN/lu2bv2/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":217.30000000074506,"connectEnd":217.30000000074506,"connectStart":217.30000000074506,"domainLookupEnd":217.30000000074506,"domainLookupStart":217.30000000074506,"fetchStart":217.30000000074506,"redirectEnd":0,"redirectStart":0,"requestStart":217.30000000074506,"responseEnd":820.3000000007451,"responseStart":820.3000000007451,"secureConnectionStart":217.30000000074506},{"duration":603.2000000011176,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":217.59999999962747,"connectEnd":217.59999999962747,"connectStart":217.59999999962747,"domainLookupEnd":217.59999999962747,"domainLookupStart":217.59999999962747,"fetchStart":217.59999999962747,"redirectEnd":0,"redirectStart":0,"requestStart":217.59999999962747,"responseEnd":820.8000000007451,"responseStart":820.8000000007451,"secureConnectionStart":217.59999999962747},{"duration":603.4000000003725,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":217.80000000074506,"connectEnd":217.80000000074506,"connectStart":217.80000000074506,"domainLookupEnd":217.80000000074506,"domainLookupStart":217.80000000074506,"fetchStart":217.80000000074506,"redirectEnd":0,"redirectStart":0,"requestStart":217.80000000074506,"responseEnd":821.2000000011176,"responseStart":821.2000000011176,"secureConnectionStart":217.80000000074506},{"duration":679.8000000007451,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bv2/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":217.90000000037253,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":217.90000000037253,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":897.7000000011176,"responseStart":0,"secureConnectionStart":0},{"duration":603.6000000014901,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":218.09999999962747,"connectEnd":218.09999999962747,"connectStart":218.09999999962747,"domainLookupEnd":218.09999999962747,"domainLookupStart":218.09999999962747,"fetchStart":218.09999999962747,"redirectEnd":0,"redirectStart":0,"requestStart":218.09999999962747,"responseEnd":821.7000000011176,"responseStart":821.7000000011176,"secureConnectionStart":218.09999999962747},{"duration":679.6999999992549,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bv2/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":218.2000000011176,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":218.2000000011176,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":897.9000000003725,"responseStart":0,"secureConnectionStart":0},{"duration":603.8000000007451,"initiatorType":"script","name":"https://jira.mariadb.org/s/719848dd97ebe0663199f49a3936487a-CDN/lu2bv2/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":218.40000000037253,"connectEnd":218.40000000037253,"connectStart":218.40000000037253,"domainLookupEnd":218.40000000037253,"domainLookupStart":218.40000000037253,"fetchStart":218.40000000037253,"redirectEnd":0,"redirectStart":0,"requestStart":218.40000000037253,"responseEnd":822.2000000011176,"responseStart":822.2000000011176,"secureConnectionStart":218.40000000037253},{"duration":843.8000000007451,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":224,"connectEnd":224,"connectStart":224,"domainLookupEnd":224,"domainLookupStart":224,"fetchStart":224,"redirectEnd":0,"redirectStart":0,"requestStart":224,"responseEnd":1067.800000000745,"responseStart":1067.800000000745,"secureConnectionStart":224},{"duration":1336.4000000003725,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":224.40000000037253,"connectEnd":224.40000000037253,"connectStart":224.40000000037253,"domainLookupEnd":224.40000000037253,"domainLookupStart":224.40000000037253,"fetchStart":224.40000000037253,"redirectEnd":0,"redirectStart":0,"requestStart":224.40000000037253,"responseEnd":1560.800000000745,"responseStart":1560.800000000745,"secureConnectionStart":224.40000000037253},{"duration":129.69999999925494,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":938.4000000003725,"connectEnd":938.4000000003725,"connectStart":938.4000000003725,"domainLookupEnd":938.4000000003725,"domainLookupStart":938.4000000003725,"fetchStart":938.4000000003725,"redirectEnd":0,"redirectStart":0,"requestStart":938.4000000003725,"responseEnd":1068.0999999996275,"responseStart":1068.0999999996275,"secureConnectionStart":938.4000000003725},{"duration":374.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bv2/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":1201.9000000003725,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1201.9000000003725,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1576.4000000003725,"responseStart":0,"secureConnectionStart":0},{"duration":414,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bv2/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","startTime":1202.9000000003725,"connectEnd":1202.9000000003725,"connectStart":1202.9000000003725,"domainLookupEnd":1202.9000000003725,"domainLookupStart":1202.9000000003725,"fetchStart":1202.9000000003725,"redirectEnd":0,"redirectStart":0,"requestStart":1202.9000000003725,"responseEnd":1616.9000000003725,"responseStart":1616.9000000003725,"secureConnectionStart":1202.9000000003725},{"duration":420.2999999988824,"initiatorType":"script","name":"https://jira.mariadb.org/s/53a43b6764f587426c7bb9a150184c00-CDN/lu2bv2/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":1203.300000000745,"connectEnd":1203.300000000745,"connectStart":1203.300000000745,"domainLookupEnd":1203.300000000745,"domainLookupStart":1203.300000000745,"fetchStart":1203.300000000745,"redirectEnd":0,"redirectStart":0,"requestStart":1203.300000000745,"responseEnd":1623.5999999996275,"responseStart":1623.5999999996275,"secureConnectionStart":1203.300000000745}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":50,"responseStart":210,"responseEnd":224,"domLoading":215,"domInteractive":1587,"domContentLoadedEventStart":1587,"domContentLoadedEventEnd":1634,"domComplete":2973,"loadEventStart":2973,"loadEventEnd":2975,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1562.5999999996275},{"name":"bigPipe.sidebar-id.end","time":1563.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1563.7000000011176},{"name":"bigPipe.activity-panel-pipe-id.end","time":1566.5999999996275},{"name":"activityTabFullyLoaded","time":1643.0999999996275}],"measures":[],"correlationId":"136ca45cc76b96","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":94,"dbReadsTimeInMs":11,"dbConnsTimeInMs":20,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}