There is an inconsistency in the results when using the COALESCE function.
Set up table t0:
CREATE TABLE t0 (c0 BIT , c1 BIT );
INSERT INTO t0 VALUES (0, 1);
Use COALESCE in a SELECT query:
( SELECT ( COALESCE (t0.c0, t0.c1)) AS c0 FROM t0);
--Result: 48
Store the result of COALESCE in another table t1 and SELECT:
CREATE TABLE t1 AS ( SELECT ( COALESCE (t0.c0, t0.c1)) AS c0 FROM t0);
SELECT * FROM t1;
--Result: 0
The result should be consistent regardless of whether the result is directly selected or stored in another table.
duplicates
MDEV-34792
Inconsistent Results When Using NULLIF
Confirmed
chaos
created issue -
2024-08-22 10:06
chaos
made changes -
2024-08-22 10:08
Field
Original Value
New Value
Description
There is an inconsistency in the results when using the COALESCE function.
Set up table t0:
{code:sql}
CREATE TABLE t0 (c0 BIT, c1 BIT);
INSERT INTO t0 VALUES (0, 1);
{code}
Use COALESCE in a SELECT query:
{code:sql}
(SELECT (COALESCE(t0.c0, t0.c1)) AS c0 FROM t0);
--Result: 48
{code}
Store the result of COALESCE in another table t1 and SELECT:
{code:sql}
CREATE TABLE t1 AS (SELECT (COALESCE(t0.c0, t0.c1)) AS c0 FROM t0);
SELECT (COALESCE(t0.c0, t0.c1)) AS c0 FROM t0;
--Result: 1
{code}
The result should be consistent regardless of whether the result is directly selected or stored in another table.
There is an inconsistency in the results when using the COALESCE function.
Set up table t0:
{code:sql}
CREATE TABLE t0 (c0 BIT, c1 BIT);
INSERT INTO t0 VALUES (0, 1);
{code}
Use COALESCE in a SELECT query:
{code:sql}
(SELECT (COALESCE(t0.c0, t0.c1)) AS c0 FROM t0);
--Result: 48
{code}
Store the result of COALESCE in another table t1 and SELECT:
{code:sql}
CREATE TABLE t1 AS (SELECT (COALESCE(t0.c0, t0.c1)) AS c0 FROM t0);
SELECT * FROM t1;
--Result: 0
{code}
The result should be consistent regardless of whether the result is directly selected or stored in another table.
chaos
made changes -
2024-08-22 12:42
Affects Version/s
10.6.0
[ 24431
]
Affects Version/s
11.4.3
[ 29837
]
chaos
made changes -
2024-10-15 07:59
Summary
Inconsistent Results When Using COALESCE
Nu
chaos
made changes -
2024-10-15 08:00
Summary
Nu
Inconsistency in the results when using the COALESCE function
Sergei Golubchik
made changes -
2024-12-27 16:04
Component/s
Data types
[ 13906
]
Component/s
Server
[ 13907
]
Fix Version/s
N/A
[ 14700
]
Resolution
Duplicate
[ 3
]
Status
Open
[ 1
]
Closed
[ 6
]
{"report":{"fcp":2008,"ttfb":688.7999997138977,"pageVisibility":"visible","entityId":130425,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"e3843ea3-1502-49c2-89d1-e8134a0eb965","navigationType":0,"readyForUser":2095.8999996185303,"redirectCount":0,"resourceLoadedEnd":2886.699999809265,"resourceLoadedStart":696.5999999046326,"resourceTiming":[{"duration":632.0999999046326,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":696.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":696.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1328.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":632.1999998092651,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1329.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":763.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":697.0999999046326,"connectEnd":697.0999999046326,"connectStart":697.0999999046326,"domainLookupEnd":697.0999999046326,"domainLookupStart":697.0999999046326,"fetchStart":697.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":697.0999999046326,"responseEnd":1460.5,"responseStart":1460.5,"secureConnectionStart":697.0999999046326},{"duration":881.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":697.3999996185303,"connectEnd":697.3999996185303,"connectStart":697.3999996185303,"domainLookupEnd":697.3999996185303,"domainLookupStart":697.3999996185303,"fetchStart":697.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":697.3999996185303,"responseEnd":1579.1999998092651,"responseStart":1579.1999998092651,"secureConnectionStart":697.3999996185303},{"duration":886.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":697.5999999046326,"connectEnd":697.5999999046326,"connectStart":697.5999999046326,"domainLookupEnd":697.5999999046326,"domainLookupStart":697.5999999046326,"fetchStart":697.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":697.5999999046326,"responseEnd":1584.0999999046326,"responseStart":1584.0999999046326,"secureConnectionStart":697.5999999046326},{"duration":887.3000001907349,"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":697.6999998092651,"connectEnd":697.6999998092651,"connectStart":697.6999998092651,"domainLookupEnd":697.6999998092651,"domainLookupStart":697.6999998092651,"fetchStart":697.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":697.6999998092651,"responseEnd":1585,"responseStart":1585,"secureConnectionStart":697.6999998092651},{"duration":887.6000003814697,"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":697.8999996185303,"connectEnd":697.8999996185303,"connectStart":697.8999996185303,"domainLookupEnd":697.8999996185303,"domainLookupStart":697.8999996185303,"fetchStart":697.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":697.8999996185303,"responseEnd":1585.5,"responseStart":1585.5,"secureConnectionStart":697.8999996185303},{"duration":921.4000000953674,"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":698.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":698.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1619.5,"responseStart":0,"secureConnectionStart":0},{"duration":887.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":698.1999998092651,"connectEnd":698.1999998092651,"connectStart":698.1999998092651,"domainLookupEnd":698.1999998092651,"domainLookupStart":698.1999998092651,"fetchStart":698.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":698.1999998092651,"responseEnd":1586,"responseStart":1586,"secureConnectionStart":698.1999998092651},{"duration":921.5,"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":698.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":698.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1619.7999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":888.6999998092651,"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":698.5,"connectEnd":698.5,"connectStart":698.5,"domainLookupEnd":698.5,"domainLookupStart":698.5,"fetchStart":698.5,"redirectEnd":0,"redirectStart":0,"requestStart":698.5,"responseEnd":1587.1999998092651,"responseStart":1587.1999998092651,"secureConnectionStart":698.5},{"duration":2186.5999999046326,"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":699.5,"connectEnd":699.5,"connectStart":699.5,"domainLookupEnd":699.5,"domainLookupStart":699.5,"fetchStart":699.5,"redirectEnd":0,"redirectStart":0,"requestStart":699.5,"responseEnd":2886.0999999046326,"responseStart":2886.0999999046326,"secureConnectionStart":699.5},{"duration":2176.300000190735,"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":710.3999996185303,"connectEnd":710.3999996185303,"connectStart":710.3999996185303,"domainLookupEnd":710.3999996185303,"domainLookupStart":710.3999996185303,"fetchStart":710.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":710.3999996185303,"responseEnd":2886.699999809265,"responseStart":2886.699999809265,"secureConnectionStart":710.3999996185303},{"duration":1058.9000000953674,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1640.6999998092651,"connectEnd":1640.6999998092651,"connectStart":1640.6999998092651,"domainLookupEnd":1640.6999998092651,"domainLookupStart":1640.6999998092651,"fetchStart":1640.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1640.6999998092651,"responseEnd":2699.5999999046326,"responseStart":2699.5,"secureConnectionStart":1640.6999998092651},{"duration":890.1999998092651,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1999.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1999.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2889.699999809265,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":517,"responseStart":689,"responseEnd":696,"domLoading":694,"domInteractive":2945,"domContentLoadedEventStart":2945,"domContentLoadedEventEnd":2996,"domComplete":3575,"loadEventStart":3575,"loadEventEnd":3575,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2893.5},{"name":"bigPipe.sidebar-id.end","time":2894.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.start","time":2894.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":2896.699999809265},{"name":"activityTabFullyLoaded","time":3028.8999996185303}],"measures":[],"correlationId":"fdf0c8ae8d92cb","effectiveType":"4g","downlink":9.1,"rtt":0,"serverDuration":114,"dbReadsTimeInMs":17,"dbConnsTimeInMs":26,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}