Run these queries in release build:
CREATE TABLE t0 ( c52 INT DEFAULT ( 92 ) DEFAULT ( NOT HEX ( 68 ) SOUNDS LIKE CASE 2 WHEN -107 THEN -96 ELSE -50 END ) , c28 INT ) ;
INSERT INTO t0 VALUES ( 27 , 68 ) , ( -123 , 68 ) ;
CREATE VIEW v0 AS SELECT c52 AS c34 , c52 AS c53 , 116 AS c44 FROM t0 ;
WITH t1 AS ( SELECT -82 AS c5 , -124 AS c48 ) SELECT t2 . c48 AS c2 FROM t0 JOIN t1 AS t2 ON t2 . c48 = ( SIN ( -65 ) + RAND ( ) * NULLIF ( 37 , 114 IN ( 29 , 88 , 23 ) ) ) WHERE t0 . c52 = ALL ( SELECT c48 AS c54 FROM t0 GROUP BY c52 , c52 HAVING REPEAT ( c5 , TRUNCATE ( 69 , -5685734343884310159 ) - TRUNCATE ( 39 , 74 ) = 56 IS NOT FALSE ) IS NULL = t0 . c52 IS NOT NULL = 61 ) IS FALSE ;
Will trigger Segmentation fault.
GDB info:
Thread 17 "mariadbd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe011a700 (LWP 45782)]
0x0000555556003ab7 in Item_field::fix_fields (this=0x7fff98078f10, thd=0x7fff98000c58,
reference=0x7fff98073630) at /home/wx/mariadb-11.3.0/sql/item.cc:6013
6013 if ((from_field= find_field_in_tables(thd, this,
#0 0x0000555556003ab7 in Item_field::fix_fields (this=0x7fff98078f10, thd=0x7fff98000c58,
reference=0x7fff98073630) at /home/wx/mariadb-11.3.0/sql/item.cc:6013
#1 0x00005555560472dd in Item::fix_fields_if_needed (ref=0x7fff98073630, thd=0x7fff98000c58,
this=0x7fff98078f10) at /home/wx/mariadb-11.3.0/sql/item.h:1145
#2 Item::fix_fields_if_needed (ref=0x7fff98073630, thd=0x7fff98000c58, this=0x7fff98078f10)
at /home/wx/mariadb-11.3.0/sql/item.h:1145
#3 Item_func::fix_fields (ref=<optimized out>, thd=0x7fff98000c58, this=0x7fff980735b0)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:349
#4 Item_func::fix_fields (this=this@entry=0x7fff980735b0, thd=thd@entry=0x7fff98000c58,
ref=<optimized out>) at /home/wx/mariadb-11.3.0/sql/item_func.cc:316
#5 0x000055555607d0b6 in Item_str_func::fix_fields (this=0x7fff980735b0, thd=0x7fff98000c58,
ref=<optimized out>) at /home/wx/mariadb-11.3.0/sql/item_strfunc.cc:132
#6 0x00005555560472dd in Item::fix_fields_if_needed (ref=0x7fff98073700, thd=0x7fff98000c58,
this=0x7fff980735b0) at /home/wx/mariadb-11.3.0/sql/item.h:1145
#7 Item::fix_fields_if_needed (ref=0x7fff98073700, thd=0x7fff98000c58, this=0x7fff980735b0)
at /home/wx/mariadb-11.3.0/sql/item.h:1145
#8 Item_func::fix_fields (ref=<optimized out>, thd=0x7fff98000c58, this=0x7fff98073680)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:349
#9 Item_func::fix_fields (this=0x7fff98073680, thd=0x7fff98000c58, ref=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:316
#10 0x00005555560472dd in Item::fix_fields_if_needed (ref=0x7fff980738d0, thd=0x7fff98000c58,
this=0x7fff98073680) at /home/wx/mariadb-11.3.0/sql/item.h:1145
#11 Item::fix_fields_if_needed (ref=0x7fff980738d0, thd=0x7fff98000c58, this=0x7fff98073680)
at /home/wx/mariadb-11.3.0/sql/item.h:1145
#12 Item_func::fix_fields (ref=<optimized out>, thd=0x7fff98000c58, this=0x7fff98073850)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:349
#13 Item_func::fix_fields (this=0x7fff98073850, thd=0x7fff98000c58, ref=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:316
#14 0x00005555560472dd in Item::fix_fields_if_needed (ref=0x7fff98073b00, thd=0x7fff98000c58,
this=0x7fff98073850) at /home/wx/mariadb-11.3.0/sql/item.h:1145
#15 Item::fix_fields_if_needed (ref=0x7fff98073b00, thd=0x7fff98000c58, this=0x7fff98073850)
at /home/wx/mariadb-11.3.0/sql/item.h:1145
#16 Item_func::fix_fields (ref=<optimized out>, thd=0x7fff98000c58, this=0x7fff98073a80)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:349
#17 Item_func::fix_fields (this=0x7fff98073a80, thd=0x7fff98000c58, ref=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:316
#18 0x00005555560472dd in Item::fix_fields_if_needed (ref=0x7fff98073c40, thd=0x7fff98000c58,
this=0x7fff98073a80) at /home/wx/mariadb-11.3.0/sql/item.h:1145
#19 Item::fix_fields_if_needed (ref=0x7fff98073c40, thd=0x7fff98000c58, this=0x7fff98073a80)
at /home/wx/mariadb-11.3.0/sql/item.h:1145
#20 Item_func::fix_fields (ref=<optimized out>, thd=0x7fff98000c58, this=0x7fff98073bc0)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:349
#21 Item_func::fix_fields (this=0x7fff98073bc0, thd=0x7fff98000c58, ref=<optimized out>)
at /home/wx/mariadb-11.3.0/sql/item_func.cc:316
#22 0x0000555555d5ce42 in st_select_lex::pushdown_from_having_into_where (
this=0x7fff98071d40, thd=0x7fff98000c58, having=0x0)
at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:11284
#23 0x0000555555dec7f4 in JOIN::optimize_inner (this=this@entry=0x7fff98078498)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:2380
#24 0x0000555555defccd in JOIN::optimize (this=this@entry=0x7fff98078498)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:1944
#25 0x0000555555d4db06 in st_select_lex::optimize_unflattened_subqueries (
this=0x7fff98013fb8, const_only=const_only@entry=false)
at /home/wx/mariadb-11.3.0/sql/sql_lex.cc:4916
#26 0x0000555555ede872 in JOIN::optimize_unflattened_subqueries (
this=this@entry=0x7fff98075398) at /home/wx/mariadb-11.3.0/sql/opt_subselect.cc:5864
#27 0x0000555555dea9b7 in JOIN::optimize_stage2 (this=this@entry=0x7fff98075398)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:3229
#28 0x0000555555ded98c in JOIN::optimize_inner (this=this@entry=0x7fff98075398)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:2650
#29 0x0000555555defccd in JOIN::optimize (this=this@entry=0x7fff98075398)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:1944
#30 0x0000555555defdc1 in mysql_select (thd=thd@entry=0x7fff98000c58, tables=0x7fff980145f8,
fields=..., conds=0x7fff98074988, og_num=0, order=0x0, group=0x0, having=0x0,
proc_param=0x0, select_options=<optimized out>, result=0x7fff98075370,
unit=0x7fff98004ee8, select_lex=0x7fff98013fb8)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:5235
#31 0x0000555555df0607 in handle_select (thd=thd@entry=0x7fff98000c58,
lex=lex@entry=0x7fff98004e08, result=result@entry=0x7fff98075370,
setup_tables_done_option=setup_tables_done_option@entry=0)
at /home/wx/mariadb-11.3.0/sql/sql_select.cc:628
#32 0x0000555555d6de41 in execute_sqlcom_select (thd=thd@entry=0x7fff98000c58,
all_tables=0x7fff980145f8) at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:6013
#33 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
#34 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
#35 0x0000555555d74fdd in dispatch_command (command=command@entry=COM_QUERY,
thd=thd@entry=0x7fff98000c58,
packet=packet@entry=0x7fff98008509 "WITH t1 AS ( SELECT -82 AS c5 , -124 AS c48 ) SELECT t2 . c48 AS c2 FROM t0 JOIN t1 AS t2 ON t2 . c48 = ( SIN ( -65 ) + RAND ( ) * NULLIF ( 37 , 114 IN ( 29 , 88 , 23 ) ) ) WHERE t0 . c52 = ALL ( SELE"...,
packet_length=packet_length@entry=390, blocking=blocking@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_class.h:251
#36 0x0000555555d7721e in do_command (thd=0x7fff98000c58, blocking=blocking@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_parse.cc:1406
#37 0x0000555555e9a617 in do_handle_one_connection (connect=<optimized out>,
connect@entry=0x555557e0c6d8, put_in_cache=put_in_cache@entry=true)
at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1445
#38 0x0000555555e9a94d in handle_one_connection (arg=arg@entry=0x555557e0c6d8)
at /home/wx/mariadb-11.3.0/sql/sql_connect.cc:1347
#39 0x00005555561e658d in pfs_spawn_thread (arg=0x555557db5ee8)
at /home/wx/mariadb-11.3.0/storage/perfschema/pfs.cc:2201
#40 0x00007ffff7b48609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#41 0x00007ffff7719133 in clone () from /lib/x86_64-linux-gnu/libc.so.6
- is duplicated by
-
MDEV-29731
Crash when HAVING in a correlated subquery references columns in the outer query
-
-
Closed
{"report":{"fcp":1670.6999998092651,"ttfb":672.2999997138977,"pageVisibility":"visible","entityId":125653,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"b66a2a8b-b2fa-4bcd-9b19-704551a19fad","navigationType":0,"readyForUser":1739.5,"redirectCount":0,"resourceLoadedEnd":1331.0999999046326,"resourceLoadedStart":680.6999998092651,"resourceTiming":[{"duration":47.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":680.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":680.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":728.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":50,"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":681,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":681,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":731,"responseStart":0,"secureConnectionStart":0},{"duration":241.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":681.1999998092651,"connectEnd":681.1999998092651,"connectStart":681.1999998092651,"domainLookupEnd":681.1999998092651,"domainLookupStart":681.1999998092651,"fetchStart":681.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":735.7999997138977,"responseEnd":922.7999997138977,"responseStart":767.7999997138977,"secureConnectionStart":681.1999998092651},{"duration":547.8999996185303,"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":681.4000000953674,"connectEnd":681.4000000953674,"connectStart":681.4000000953674,"domainLookupEnd":681.4000000953674,"domainLookupStart":681.4000000953674,"fetchStart":681.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":736.0999999046326,"responseEnd":1229.2999997138977,"responseStart":751.1999998092651,"secureConnectionStart":681.4000000953674},{"duration":88.09999990463257,"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":681.5999999046326,"connectEnd":681.5999999046326,"connectStart":681.5999999046326,"domainLookupEnd":681.5999999046326,"domainLookupStart":681.5999999046326,"fetchStart":681.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":736.0999999046326,"responseEnd":769.6999998092651,"responseStart":765,"secureConnectionStart":681.5999999046326},{"duration":86.90000009536743,"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":681.6999998092651,"connectEnd":681.6999998092651,"connectStart":681.6999998092651,"domainLookupEnd":681.6999998092651,"domainLookupStart":681.6999998092651,"fetchStart":681.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":736.4000000953674,"responseEnd":768.5999999046326,"responseStart":758,"secureConnectionStart":681.6999998092651},{"duration":89.39999961853027,"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":681.9000000953674,"connectEnd":681.9000000953674,"connectStart":681.9000000953674,"domainLookupEnd":681.9000000953674,"domainLookupStart":681.9000000953674,"fetchStart":681.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":736.5,"responseEnd":771.2999997138977,"responseStart":768.7999997138977,"secureConnectionStart":681.9000000953674},{"duration":53.19999980926514,"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":682.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":682.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":735.2999997138977,"responseStart":0,"secureConnectionStart":0},{"duration":89.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":682.4000000953674,"connectEnd":682.4000000953674,"connectStart":682.4000000953674,"domainLookupEnd":682.4000000953674,"domainLookupStart":682.4000000953674,"fetchStart":682.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":742.1999998092651,"responseEnd":771.5,"responseStart":769.7999997138977,"secureConnectionStart":682.4000000953674},{"duration":53.59999990463257,"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":682.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":682.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":736.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":92.59999990463257,"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":682.6999998092651,"connectEnd":682.6999998092651,"connectStart":682.6999998092651,"domainLookupEnd":682.6999998092651,"domainLookupStart":682.6999998092651,"fetchStart":682.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":742.4000000953674,"responseEnd":775.2999997138977,"responseStart":770.5,"secureConnectionStart":682.6999998092651},{"duration":642.5,"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":688.1999998092651,"connectEnd":688.1999998092651,"connectStart":688.1999998092651,"domainLookupEnd":688.1999998092651,"domainLookupStart":688.1999998092651,"fetchStart":688.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":933.2999997138977,"responseEnd":1330.6999998092651,"responseStart":1288.0999999046326,"secureConnectionStart":688.1999998092651},{"duration":642.8000001907349,"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":688.2999997138977,"connectEnd":688.2999997138977,"connectStart":688.2999997138977,"domainLookupEnd":688.2999997138977,"domainLookupStart":688.2999997138977,"fetchStart":688.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":933.9000000953674,"responseEnd":1331.0999999046326,"responseStart":1298.4000000953674,"secureConnectionStart":688.2999997138977},{"duration":290.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1083,"connectEnd":1083,"connectStart":1083,"domainLookupEnd":1083,"domainLookupStart":1083,"fetchStart":1083,"redirectEnd":0,"redirectStart":0,"requestStart":1242.4000000953674,"responseEnd":1373.5999999046326,"responseStart":1336.7999997138977,"secureConnectionStart":1083}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":104,"responseStart":672,"responseEnd":685,"domLoading":678,"domInteractive":1846,"domContentLoadedEventStart":1846,"domContentLoadedEventEnd":1907,"domComplete":2879,"loadEventStart":2879,"loadEventEnd":2879,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1792.9000000953674},{"name":"bigPipe.sidebar-id.end","time":1793.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1794},{"name":"bigPipe.activity-panel-pipe-id.end","time":1796.2999997138977},{"name":"activityTabFullyLoaded","time":1926.4000000953674}],"measures":[],"correlationId":"73c7cd5ef5df97","effectiveType":"4g","downlink":9.3,"rtt":0,"serverDuration":511,"dbReadsTimeInMs":14,"dbConnsTimeInMs":24,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Also crashes 10.6
in Item_func::fix_fields() call to each arg in args if ((*arg)->fix_fields_if_needed(thd, arg))
(rr) p (*arg)->type()
$10 = Item::FIELD_ITEM
(rr) p ((Item_field *)(*arg))->field
$11 = (Field *) 0x0
(rr) p dbug_print_item(*arg)
$12 = 0x55c268327fe0 <dbug_item_print_buf> "t2.c5"
(rr) p dbug_print_item(this)
$13 = 0x55c268327fe0 <dbug_item_print_buf> "repeat(t2.c5,truncate(69,-5685734343884310159) - truncate(39,74) = 56 is not false)"
erroneous Item_field created in JOIN::prepare()
bool having_fix_rc= having->fix_fields_if_needed_for_bool(thd, &having);
(rr) p dbug_print_item(having)
$16 = 0x55c268327fe0 <dbug_item_print_buf> "/*always not null*/ 1 is null = t0.c52 is not null = 61"
...
(rr) p dbug_print_item(*arg)
$17 = 0x55c268327fe0 <dbug_item_print_buf> "/*always not null*/ 1 is null = t0.c52 is not null"
...
(rr) p dbug_print_item(*arg)
$18 = 0x55c268327fe0 <dbug_item_print_buf> "/*always not null*/ 1 is null = t0.c52"
...
(rr) p dbug_print_item(*arg)
$19 = 0x55c268327fe0 <dbug_item_print_buf> "/*always not null*/ 1 is null"
...
/* how did this end up as an arg to the above? Set that way in the parser */
...
(rr) p dbug_print_item(*arg)
$20 = 0x55c268327fe0 <dbug_item_print_buf> "repeat(c5,truncate(69,-5685734343884310159) - truncate(39,74) = 56 is not false)"
So potential parser issue.