Type:
Bug
Priority:
Major
Resolution:
Fixed
Affects Version/s:
10.0(EOL) , 10.1(EOL) , 10.2(EOL) , 10.3(EOL) , 10.4(EOL) , 10.5
I run this script using two timestamp values near DST change:
SET time_zone= 'Europe/Moscow' ;
CREATE OR REPLACE TABLE t1 (i INT , d TIMESTAMP );
SET timestamp =1288477526 /* this is summer time */ ;
INSERT INTO t1 VALUES (3, NULL );
SET timestamp =1288477526+3599 /* this is winter time*/ ;
INSERT INTO t1 VALUES (3, NULL );
SELECT i, d, UNIX_TIMESTAMP(d) FROM t1 ORDER BY d;
+------+---------------------+-------------------+
| i | d | UNIX_TIMESTAMP(d) |
+------+---------------------+-------------------+
| 3 | 2010-10-31 02:25:26 | 1288477526 |
| 3 | 2010-10-31 02:25:25 | 1288481125 |
+------+---------------------+-------------------+
The record with Unix timestamp value of 1288477526 returned first, because it is smaller.
Now I run a GROUP BY query with MIN:
SELECT i, MIN (d) FROM t1 GROUP BY i;
+------+---------------------+
| i | MIN(d) |
+------+---------------------+
| 3 | 2010-10-31 02:25:25 |
+------+---------------------+
It erroneously chose a wrong record.
This happens because TIMESTAMP in this piece of code is handled in striing format (which uses DATETIME rather than TIMESTAMP representation):
void Item_sum_hybrid::update_field()
{
DBUG_ENTER( "Item_sum_hybrid::update_field" );
Item *UNINIT_VAR(tmp_item);
if (unlikely(direct_added))
{
tmp_item= args[0];
args[0]= direct_item;
}
switch (result_type()) {
case STRING_RESULT:
min_max_update_str_field();
break ;
case INT_RESULT:
min_max_update_int_field();
break ;
case DECIMAL_RESULT:
min_max_update_decimal_field();
break ;
default :
min_max_update_real_field();
}
if (unlikely(direct_added))
{
direct_added= FALSE;
args[0]= tmp_item;
}
DBUG_VOID_RETURN;
}
There are no comments yet on this issue.
{"report":{"fcp":864.7000000476837,"ttfb":165,"pageVisibility":"visible","entityId":77327,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"21dcf55e-271c-4ba8-9482-14d527759841","navigationType":0,"readyForUser":995.9000000953674,"redirectCount":0,"resourceLoadedEnd":569.9000000953674,"resourceLoadedStart":174.90000009536743,"resourceTiming":[{"duration":14.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":174.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":174.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":189.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":15.5,"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":175.20000004768372,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":175.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":190.70000004768372,"responseStart":0,"secureConnectionStart":0},{"duration":267.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":175.29999995231628,"connectEnd":175.29999995231628,"connectStart":175.29999995231628,"domainLookupEnd":175.29999995231628,"domainLookupStart":175.29999995231628,"fetchStart":175.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":195.40000009536743,"responseEnd":442.60000014305115,"responseStart":216.90000009536743,"secureConnectionStart":175.29999995231628},{"duration":394,"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":175.90000009536743,"connectEnd":175.90000009536743,"connectStart":175.90000009536743,"domainLookupEnd":175.90000009536743,"domainLookupStart":175.90000009536743,"fetchStart":175.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":197.60000014305115,"responseEnd":569.9000000953674,"responseStart":224.79999995231628,"secureConnectionStart":175.90000009536743},{"duration":51.799999952316284,"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.10000014305115,"connectEnd":176.10000014305115,"connectStart":176.10000014305115,"domainLookupEnd":176.10000014305115,"domainLookupStart":176.10000014305115,"fetchStart":176.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":197.79999995231628,"responseEnd":227.90000009536743,"responseStart":225.40000009536743,"secureConnectionStart":176.10000014305115},{"duration":57.5,"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.10000014305115,"connectEnd":176.10000014305115,"connectStart":176.10000014305115,"domainLookupEnd":176.10000014305115,"domainLookupStart":176.10000014305115,"fetchStart":176.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":199.90000009536743,"responseEnd":233.60000014305115,"responseStart":229.40000009536743,"secureConnectionStart":176.10000014305115},{"duration":57.59999990463257,"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.20000004768372,"connectEnd":176.20000004768372,"connectStart":176.20000004768372,"domainLookupEnd":176.20000004768372,"domainLookupStart":176.20000004768372,"fetchStart":176.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":200.29999995231628,"responseEnd":233.79999995231628,"responseStart":229.90000009536743,"secureConnectionStart":176.20000004768372},{"duration":20.40000009536743,"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.29999995231628,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":176.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":196.70000004768372,"responseStart":0,"secureConnectionStart":0},{"duration":57.5,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":176.29999995231628,"connectEnd":176.29999995231628,"connectStart":176.29999995231628,"domainLookupEnd":176.29999995231628,"domainLookupStart":176.29999995231628,"fetchStart":176.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":201.79999995231628,"responseEnd":233.79999995231628,"responseStart":230.5,"secureConnectionStart":176.29999995231628},{"duration":20.700000047683716,"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":176.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":176.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":197.20000004768372,"responseStart":0,"secureConnectionStart":0},{"duration":81.09999990463257,"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":176.60000014305115,"connectEnd":176.60000014305115,"connectStart":176.60000014305115,"domainLookupEnd":176.60000014305115,"domainLookupStart":176.60000014305115,"fetchStart":176.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":202.79999995231628,"responseEnd":257.7000000476837,"responseStart":233.90000009536743,"secureConnectionStart":176.60000014305115},{"duration":356,"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":184.60000014305115,"connectEnd":184.60000014305115,"connectStart":184.60000014305115,"domainLookupEnd":184.60000014305115,"domainLookupStart":184.60000014305115,"fetchStart":184.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":219.5,"responseEnd":540.6000001430511,"responseStart":534.4000000953674,"secureConnectionStart":184.60000014305115},{"duration":356.7999999523163,"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":184.60000014305115,"connectEnd":184.60000014305115,"connectStart":184.60000014305115,"domainLookupEnd":184.60000014305115,"domainLookupStart":184.60000014305115,"fetchStart":184.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":233.10000014305115,"responseEnd":541.4000000953674,"responseStart":536.6000001430511,"secureConnectionStart":184.60000014305115},{"duration":110.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":594.5,"connectEnd":594.5,"connectStart":594.5,"domainLookupEnd":594.5,"domainLookupStart":594.5,"fetchStart":594.5,"redirectEnd":0,"redirectStart":0,"requestStart":673.7999999523163,"responseEnd":705,"responseStart":704.2000000476837,"secureConnectionStart":594.5}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":26,"responseStart":165,"responseEnd":184,"domLoading":169,"domInteractive":1061,"domContentLoadedEventStart":1061,"domContentLoadedEventEnd":1105,"domComplete":1637,"loadEventStart":1637,"loadEventEnd":1637,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1043.7999999523163},{"name":"bigPipe.sidebar-id.end","time":1044.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1044.7000000476837},{"name":"bigPipe.activity-panel-pipe-id.end","time":1045.2999999523163},{"name":"activityTabFullyLoaded","time":1116.2999999523163}],"measures":[],"correlationId":"648ca82fdf85ec","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":73,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}