Run these queries in release build:
CREATE TABLE t0 ( c43 DECIMAL ( 31 ) DEFAULT ( 45 ) ) ;
INSERT INTO t0 VALUES ( 13 ) , ( 29 ) ;
ALTER TABLE t0 ADD COLUMN c24 INT AFTER c43 ;
INSERT INTO t0 VALUES ( DEFAULT , DEFAULT ) , ( DEFAULT , DEFAULT ) ;
SELECT t1 . c22 AS c9 FROM ( SELECT ( SELECT + EXISTS ( SELECT -128 AS c29 ) << LOCATE ( t0 . c43 , t0 . c24 <= t0 . c24 NOT BETWEEN 4642475734208631537 AND -108 , NULLIF ( 57 , -8 ) SOUNDS LIKE TRIM( TRAILING FROM 6107036197732405580 ) ) - t0 . c43 AS c57 FROM t0 LIMIT 1 ) AS c22 FROM t0 ) AS t1 HAVING TRIM( CASE t1 . c22 WHEN -16 THEN RAND ( ) % HEX ( t1 . c22 ) - SUBSTRING_INDEX ( t1 . c22 , ':A9SEZxtjN,fKN*zR' , 'V*vhJb}&c%Op,[T[S,j`F9NDsK;\'8 4;m"
P,ce}1r"3ID1DN' ) >> NULLIF ( t1 . c22 , -95 ) ELSE -2 END IS TRUE FROM t1 . c22 >= EXISTS ( SELECT t2 . c57 AS c59 FROM ( SELECT CASE c24 WHEN -103 THEN 85 ELSE 22 END IS TRUE AS c57 FROM t0 ) AS t2 WHERE MOD ( 64 , 46 ) = CONVERT ( 73 , BINARY ) % RAND ( ) IS NOT NULL = -65 GROUP BY c57 , c22 , c22 WINDOW w0 AS ( PARTITION BY t2 . c57 ) ) & PI ( ) ) ;
Will trigger Segmentation fault.
GDB info:
Thread 17 "mariadbd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe011a700 (LWP 45342)]
0x0000555555d4af6a in st_select_lex_unit::set_limit (this=0x7fff980719d0, sl=0x0)
at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4227
4227 lim.set_limit(sl->get_limit(), sl->get_offset(), sl->limit_params.with_ties);
(gdb) p sl
$1 = (st_select_lex *) 0x0
#0 0x0000555555d4af6a in st_select_lex_unit::set_limit (this=0x7fff980719d0, sl=0x0)
at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4227
#1 0x00005555560b133e in subselect_single_select_engine::exec (this=0x7fff98016bb0)
at /home/wx/mariadb-11.3.0/sql/item_subselect.cc:4074
#2 0x00005555560b040c in Item_subselect::exec (this=0x7fff98016a20)
at /home/wx/mariadb-11.3.0/sql/item_subselect.cc:812
#3 0x00005555560afd03 in Item_singlerow_subselect::val_int (this=0x7fff98016a20)
at /home/wx/mariadb-11.3.0/sql/item_subselect.cc:1462
#4 0x0000555555fef893 in Item_direct_view_ref::val_int_result (this=0x7fff9807c578)
at /home/wx/mariadb-11.3.0/sql/item.cc:9518
#5 0x0000555555fef2e3 in Item_ref::val_int (this=0x7fff98074cd0)
at /home/wx/mariadb-11.3.0/sql/item.cc:8522
#6 0x00005555560106cd in Arg_comparator::compare_int_unsigned (this=0x7fff980793b8)
at /home/wx/mariadb-11.3.0/sql/item_cmpfunc.cc:963
#7 0x0000555556010d2f in Arg_comparator::compare (this=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item_cmpfunc.h:104
#8 Item_func_ge::val_int (this=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item_cmpfunc.cc:1812
#9 0x0000555556044dba in Item_int_func::val_str (this=0x7fff98079300, str=0x7fffe01182e0)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:760
#10 0x00005555560835ed in Item_func_trim::val_str (this=0x7fff98079528, str=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item_strfunc.cc:2477
#11 0x000055555607f344 in Item_str_func::val_int (this=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item_strfunc.cc:165
#12 0x0000555555dd9c5d in end_send (join=0x7fff98079ef8, join_tab=0x7fff98085168,
end_of_records=<optimized out>) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:24685
#13 0x0000555555dad6d4 in evaluate_join_record (join=join@entry=0x7fff98079ef8,
join_tab=join_tab@entry=0x7fff98084cf0, error=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:23677
#14 0x0000555555dbf7fb in sub_select (join=0x7fff98079ef8, join_tab=0x7fff98084cf0,
end_of_records=false) at /home/wx/mariadb-11.3.0/sql/sql_select.cc:23444
#15 0x0000555555df19b2 in do_select (procedure=<optimized out>, join=0x7fff98079ef8)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:22961
#16 JOIN::exec_inner (this=this@entry=0x7fff98079ef8)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:4941
#17 0x0000555555df1d78 in JOIN::exec (this=this@entry=0x7fff98079ef8)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:4718
#18 0x0000555555defe1c in mysql_select (thd=thd@entry=0x7fff98000c58, tables=0x7fff98073200,
fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x7fff98079528,
proc_param=0x0, select_options=<optimized out>, result=0x7fff98079ed0,
unit=0x7fff98004ee8, select_lex=0x7fff980132f8)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:5249
#19 0x0000555555df0607 in handle_select (thd=thd@entry=0x7fff98000c58,
lex=lex@entry=0x7fff98004e08, result=result@entry=0x7fff98079ed0,
setup_tables_done_option=setup_tables_done_option@entry=0)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:628
#20 0x0000555555d6de41 in execute_sqlcom_select (thd=thd@entry=0x7fff98000c58,
all_tables=0x7fff98073200) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:6013
#21 0x0000555555d7c2aa in mysql_execute_command (thd=thd@entry=0x7fff98000c58,
is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:3912
#22 0x0000555555d68c27 in mysql_parse (thd=0x7fff98000c58, rawbuf=<optimized out>,
length=<optimized out>, parser_state=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:7734
#23 0x0000555555d74fdd in dispatch_command (command=command@entry=COM_QUERY,
thd=thd@entry=0x7fff98000c58, packet=packet@entry=0x7fff98008509 "",
packet_length=packet_length@entry=811, blocking=blocking@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_class.h:251
#24 0x0000555555d7721e in do_command (thd=0x7fff98000c58, blocking=blocking@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1406
#25 0x0000555555e9a617 in do_handle_one_connection (connect=<optimized out>,
connect@entry=0x555557e0ae58, put_in_cache=put_in_cache@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1445
#26 0x0000555555e9a94d in handle_one_connection (arg=arg@entry=0x555557e0ae58)
at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1347
#27 0x00005555561e658d in pfs_spawn_thread (arg=0x555557db46e8)
at /home/wx/mariadb-11.3.0/storage/perfschema/pfs.cc:2201
#28 0x00007ffff7b48609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#29 0x00007ffff7719133 in clone () from /lib/x86_64-linux-gnu/libc.so.6
- duplicates
-
MDEV-28621
group by optimization incorrectly removing subquery where subject buried in a function
-
-
Closed
{"report":{"fcp":1469.3000001907349,"ttfb":486.69999980926514,"pageVisibility":"visible","entityId":125644,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"5e81fdba-ed13-4352-b4ef-1afd47b255ef","navigationType":0,"readyForUser":1564.6000003814697,"redirectCount":0,"resourceLoadedEnd":1890.6000003814697,"resourceLoadedStart":502.80000019073486,"resourceTiming":[{"duration":487,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":502.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":502.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":989.8000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":487,"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":503.1000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":503.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":990.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":496.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":503.19999980926514,"connectEnd":503.19999980926514,"connectStart":503.19999980926514,"domainLookupEnd":503.19999980926514,"domainLookupStart":503.19999980926514,"fetchStart":503.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":503.19999980926514,"responseEnd":999.3000001907349,"responseStart":999.3000001907349,"secureConnectionStart":503.19999980926514},{"duration":563.6000003814697,"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":503.5,"connectEnd":503.5,"connectStart":503.5,"domainLookupEnd":503.5,"domainLookupStart":503.5,"fetchStart":503.5,"redirectEnd":0,"redirectStart":0,"requestStart":503.5,"responseEnd":1067.1000003814697,"responseStart":1067.1000003814697,"secureConnectionStart":503.5},{"duration":567.5999994277954,"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":503.6000003814697,"connectEnd":503.6000003814697,"connectStart":503.6000003814697,"domainLookupEnd":503.6000003814697,"domainLookupStart":503.6000003814697,"fetchStart":503.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":503.6000003814697,"responseEnd":1071.1999998092651,"responseStart":1071.1999998092651,"secureConnectionStart":503.6000003814697},{"duration":567.7999992370605,"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":503.9000005722046,"connectEnd":503.9000005722046,"connectStart":503.9000005722046,"domainLookupEnd":503.9000005722046,"domainLookupStart":503.9000005722046,"fetchStart":503.9000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":503.9000005722046,"responseEnd":1071.6999998092651,"responseStart":1071.6999998092651,"secureConnectionStart":503.9000005722046},{"duration":568,"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":504.1000003814697,"connectEnd":504.1000003814697,"connectStart":504.1000003814697,"domainLookupEnd":504.1000003814697,"domainLookupStart":504.1000003814697,"fetchStart":504.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":504.1000003814697,"responseEnd":1072.1000003814697,"responseStart":1072.1000003814697,"secureConnectionStart":504.1000003814697},{"duration":641.9000005722046,"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":504.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":504.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1146.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":568.2999992370605,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":504.4000005722046,"connectEnd":504.4000005722046,"connectStart":504.4000005722046,"domainLookupEnd":504.4000005722046,"domainLookupStart":504.4000005722046,"fetchStart":504.4000005722046,"redirectEnd":0,"redirectStart":0,"requestStart":504.4000005722046,"responseEnd":1072.6999998092651,"responseStart":1072.6999998092651,"secureConnectionStart":504.4000005722046},{"duration":641.6999998092651,"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":504.6000003814697,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":504.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1146.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":568.5,"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":504.69999980926514,"connectEnd":504.69999980926514,"connectStart":504.69999980926514,"domainLookupEnd":504.69999980926514,"domainLookupStart":504.69999980926514,"fetchStart":504.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":504.69999980926514,"responseEnd":1073.1999998092651,"responseStart":1073.1999998092651,"secureConnectionStart":504.69999980926514},{"duration":1330.6999998092651,"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":505.6000003814697,"connectEnd":505.6000003814697,"connectStart":505.6000003814697,"domainLookupEnd":505.6000003814697,"domainLookupStart":505.6000003814697,"fetchStart":505.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":505.6000003814697,"responseEnd":1836.3000001907349,"responseStart":1836.3000001907349,"secureConnectionStart":505.6000003814697},{"duration":1384.9000005722046,"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":505.69999980926514,"connectEnd":505.69999980926514,"connectStart":505.69999980926514,"domainLookupEnd":505.69999980926514,"domainLookupStart":505.69999980926514,"fetchStart":505.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":505.69999980926514,"responseEnd":1890.6000003814697,"responseStart":1890.6000003814697,"secureConnectionStart":505.69999980926514},{"duration":561.3000001907349,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1159.1000003814697,"connectEnd":1159.1000003814697,"connectStart":1159.1000003814697,"domainLookupEnd":1159.1000003814697,"domainLookupStart":1159.1000003814697,"fetchStart":1159.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":1159.1000003814697,"responseEnd":1720.4000005722046,"responseStart":1720.4000005722046,"secureConnectionStart":1159.1000003814697},{"duration":542.1999998092651,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1461.3000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1461.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2003.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":325,"responseStart":486,"responseEnd":489,"domLoading":494,"domInteractive":2023,"domContentLoadedEventStart":2023,"domContentLoadedEventEnd":2067,"domComplete":4630,"loadEventStart":4630,"loadEventEnd":4632,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2004.6000003814697},{"name":"bigPipe.sidebar-id.end","time":2005.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":2005.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":2008},{"name":"activityTabFullyLoaded","time":2076}],"measures":[],"correlationId":"b0f13b2a847cac","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":106,"dbReadsTimeInMs":10,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}