SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)));
|
10.4 00f964ab
|
mysqld: /data/src/10.4/sql/item_func.cc:2470: void Item_func_round::fix_arg_int(const Type_handler*, const Type_std_attributes*, bool): Assertion `args[0]->decimals == 0' failed.
|
200803 17:06:14 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007fc24e0fff12 in __GI___assert_fail (assertion=0x55f41cf88633 "args[0]->decimals == 0", file=0x55f41cf882d0 "/data/src/10.4/sql/item_func.cc", line=2470, function=0x55f41cf8a600 <Item_func_round::fix_arg_int(Type_handler const*, Type_std_attributes const*, bool)::__PRETTY_FUNCTION__> "void Item_func_round::fix_arg_int(const Type_handler*, const Type_std_attributes*, bool)") at assert.c:101
|
#8 0x000055f41c4b60b1 in Item_func_round::fix_arg_int (this=0x7fc238013d18, preferred=0x55f41d89dcb0 <type_handler_long>, preferred_attrs=0x55f41daa8200 <Type_handler_date_common::Item_func_round_fix_length_and_dec(Item_func_round*) const::attr>, use_decimal_on_length_increase=false) at /data/src/10.4/sql/item_func.cc:2470
|
#9 0x000055f41c2edcb8 in Type_handler_date_common::Item_func_round_fix_length_and_dec (this=0x55f41d89dd40 <type_handler_newdate>, item=0x7fc238013d18) at /data/src/10.4/sql/sql_type.cc:5736
|
#10 0x000055f41c4c8eb0 in Item_func_round::fix_length_and_dec (this=0x7fc238013d18) at /data/src/10.4/sql/item_func.h:1790
|
#11 0x000055f41c4ad759 in Item_func::fix_fields (this=0x7fc238013d18, thd=0x7fc238000af0, ref=0x7fc238013df0) at /data/src/10.4/sql/item_func.cc:370
|
#12 0x000055f41bfb585f in Item::fix_fields_if_needed (this=0x7fc238013d18, thd=0x7fc238000af0, ref=0x7fc238013df0) at /data/src/10.4/sql/item.h:960
|
#13 0x000055f41bfb588d in Item::fix_fields_if_needed_for_scalar (this=0x7fc238013d18, thd=0x7fc238000af0, ref=0x7fc238013df0) at /data/src/10.4/sql/item.h:964
|
#14 0x000055f41c034287 in setup_fields (thd=0x7fc238000af0, ref_pointer_array=..., fields=..., column_usage=MARK_COLUMNS_READ, sum_func_list=0x7fc238014a80, pre_fix=0x7fc238013520, allow_sum_func=true) at /data/src/10.4/sql/sql_base.cc:7685
|
#15 0x000055f41c111e26 in JOIN::prepare (this=0x7fc238014760, tables_init=0x0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fc2380133c0, unit_arg=0x7fc238004a18) at /data/src/10.4/sql/sql_select.cc:1245
|
#16 0x000055f41c11eae5 in mysql_select (thd=0x7fc238000af0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fc238014738, unit=0x7fc238004a18, select_lex=0x7fc2380133c0) at /data/src/10.4/sql/sql_select.cc:4650
|
#17 0x000055f41c10e75c in handle_select (thd=0x7fc238000af0, lex=0x7fc238004958, result=0x7fc238014738, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:422
|
#18 0x000055f41c0d4f86 in execute_sqlcom_select (thd=0x7fc238000af0, all_tables=0x0) at /data/src/10.4/sql/sql_parse.cc:6355
|
#19 0x000055f41c0cb5bd in mysql_execute_command (thd=0x7fc238000af0) at /data/src/10.4/sql/sql_parse.cc:3889
|
#20 0x000055f41c0d8f33 in mysql_parse (thd=0x7fc238000af0, rawbuf=0x7fc2380132f0 "SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)))", length=55, parser_state=0x7fc2482a9570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7896
|
#21 0x000055f41c0c5468 in dispatch_command (command=COM_QUERY, thd=0x7fc238000af0, packet=0x7fc2381364b1 "SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)))", packet_length=55, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1835
|
#22 0x000055f41c0c3c0a in do_command (thd=0x7fc238000af0) at /data/src/10.4/sql/sql_parse.cc:1353
|
#23 0x000055f41c24cfa0 in do_handle_one_connection (connect=0x55f4200ffba0) at /data/src/10.4/sql/sql_connect.cc:1412
|
#24 0x000055f41c24ccef in handle_one_connection (arg=0x55f4200ffba0) at /data/src/10.4/sql/sql_connect.cc:1316
|
#25 0x000055f41cc4f0d5 in pfs_spawn_thread (arg=0x55f42011b720) at /data/src/10.4/storage/perfschema/pfs.cc:1869
|
#26 0x00007fc2500884a4 in start_thread (arg=0x7fc2482aa700) at pthread_create.c:456
|
#27 0x00007fc24e1bcd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
|
Reproducible on 10.4-10.5.
Not reproducible on 10.3.
The failure started happening on 10.4 after this commit:
commit dc513dff911d72eaaf9f752f390fef8d1ef9a4b0
|
Author: Alexander Barkov
|
Date: Fri Jul 31 10:42:44 2020 +0400
|
|
MDEV-23351 Rounding functions return wrong data types for DATE input
|
{"report":{"fcp":1648.9000000953674,"ttfb":309.30000019073486,"pageVisibility":"visible","entityId":90197,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"beb84ca7-984b-4659-bc8d-0f725f29ae86","navigationType":0,"readyForUser":1782.0999999046326,"redirectCount":0,"resourceLoadedEnd":1287.5,"resourceLoadedStart":321.5,"resourceTiming":[{"duration":94.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":321.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":321.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":415.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":94.09999990463257,"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":321.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":321.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":416,"responseStart":0,"secureConnectionStart":0},{"duration":723,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":322.09999990463257,"connectEnd":322.09999990463257,"connectStart":322.09999990463257,"domainLookupEnd":322.09999990463257,"domainLookupStart":322.09999990463257,"fetchStart":322.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":417.40000009536743,"responseEnd":1045.0999999046326,"responseStart":433.90000009536743,"secureConnectionStart":322.09999990463257},{"duration":939.0999999046326,"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":322.2000002861023,"connectEnd":322.2000002861023,"connectStart":322.2000002861023,"domainLookupEnd":322.2000002861023,"domainLookupStart":322.2000002861023,"fetchStart":322.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":418.90000009536743,"responseEnd":1261.3000001907349,"responseStart":441,"secureConnectionStart":322.2000002861023},{"duration":122.90000009536743,"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":322.5,"connectEnd":322.5,"connectStart":322.5,"domainLookupEnd":322.5,"domainLookupStart":322.5,"fetchStart":322.5,"redirectEnd":0,"redirectStart":0,"requestStart":419.40000009536743,"responseEnd":445.40000009536743,"responseStart":441.80000019073486,"secureConnectionStart":322.5},{"duration":125.69999980926514,"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":322.80000019073486,"connectEnd":322.80000019073486,"connectStart":322.80000019073486,"domainLookupEnd":322.80000019073486,"domainLookupStart":322.80000019073486,"fetchStart":322.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":419.7000002861023,"responseEnd":448.5,"responseStart":445.59999990463257,"secureConnectionStart":322.80000019073486},{"duration":125.80000019073486,"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":323.40000009536743,"connectEnd":323.40000009536743,"connectStart":323.40000009536743,"domainLookupEnd":323.40000009536743,"domainLookupStart":323.40000009536743,"fetchStart":323.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":420,"responseEnd":449.2000002861023,"responseStart":446.2000002861023,"secureConnectionStart":323.40000009536743},{"duration":93.59999990463257,"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":323.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":323.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":417.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":125.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":323.80000019073486,"connectEnd":323.80000019073486,"connectStart":323.80000019073486,"domainLookupEnd":323.80000019073486,"domainLookupStart":323.80000019073486,"fetchStart":323.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":420.09999990463257,"responseEnd":449.59999990463257,"responseStart":447,"secureConnectionStart":323.80000019073486},{"duration":93.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":324,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":324,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":417.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":128.2999997138977,"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":324.2000002861023,"connectEnd":324.2000002861023,"connectStart":324.2000002861023,"domainLookupEnd":324.2000002861023,"domainLookupStart":324.2000002861023,"fetchStart":324.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":420.2000002861023,"responseEnd":452.5,"responseStart":447.59999990463257,"secureConnectionStart":324.2000002861023},{"duration":953.9000000953674,"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":332,"connectEnd":332,"connectStart":332,"domainLookupEnd":332,"domainLookupStart":332,"fetchStart":332,"redirectEnd":0,"redirectStart":0,"requestStart":525.0999999046326,"responseEnd":1285.9000000953674,"responseStart":1270.4000000953674,"secureConnectionStart":332},{"duration":955.1999998092651,"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":332.30000019073486,"connectEnd":332.30000019073486,"connectStart":332.30000019073486,"domainLookupEnd":332.30000019073486,"domainLookupStart":332.30000019073486,"fetchStart":332.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":720.0999999046326,"responseEnd":1287.5,"responseStart":1276.5,"secureConnectionStart":332.30000019073486},{"duration":235.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1216,"connectEnd":1216,"connectStart":1216,"domainLookupEnd":1216,"domainLookupStart":1216,"fetchStart":1216,"redirectEnd":0,"redirectStart":0,"requestStart":1417.7000002861023,"responseEnd":1451.8000001907349,"responseStart":1451.2000002861023,"secureConnectionStart":1216},{"duration":132,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1583,"connectEnd":1583,"connectStart":1583,"domainLookupEnd":1583,"domainLookupStart":1583,"fetchStart":1583,"redirectEnd":0,"redirectStart":0,"requestStart":1684.5999999046326,"responseEnd":1715,"responseStart":1714.2000002861023,"secureConnectionStart":1583},{"duration":228.7999997138977,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1639.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1639.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1868.0999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":91,"domainLookupEnd":115,"connectStart":115,"connectEnd":140,"secureConnectionStart":125,"requestStart":142,"responseStart":309,"responseEnd":332,"domLoading":319,"domInteractive":1895,"domContentLoadedEventStart":1895,"domContentLoadedEventEnd":1976,"domComplete":2563,"loadEventStart":2563,"loadEventEnd":2563,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1870.4000000953674},{"name":"bigPipe.sidebar-id.end","time":1871.2000002861023},{"name":"bigPipe.activity-panel-pipe-id.start","time":1871.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":1872.8000001907349},{"name":"activityTabFullyLoaded","time":2001.7000002861023}],"measures":[],"correlationId":"1b08571c64f292","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":92,"dbReadsTimeInMs":14,"dbConnsTimeInMs":22,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The problem is that GREATEST() incorrectly calculates its decimals as 6:
mysql --column-type-info displays the following output:
Field 1: `GREATEST('1', CAST('2020-12-12' AS DATE))`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: DATE
Collation: binary (63)
Length: 10
Max_length: 10
Decimals: 6
Flags: BINARY
+-------------------------------------------+
| GREATEST('1', CAST('2020-12-12' AS DATE)) |
+-------------------------------------------+
| 2020-12-12 |
+-------------------------------------------+
1 row in set, 1 warning (0.001 sec)