[MDEV-9933] [Fixed in devtree] EXPLAIN crashes for a CTE query Created: 2016-04-17  Updated: 2016-09-04  Resolved: 2016-09-04

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - CTE
Fix Version/s: 10.2.2

Type: Task Priority: Major
Reporter: Sergei Petrunia Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: CTE


 Description   

I am trying this (not very meaningful) testcase:

create table t20 (a int, b int);
insert into t20 values (1,1);
explain with X as (select * from t20) select * from t20;

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff4300f00 (LWP 18016)]
0x0000555555a75e8c in st_select_lex::update_used_tables (this=0x7fff54012dc8)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_lex.cc:4217
4217      join->result->update_used_tables();
(gdb) p join->result
$1 = (select_result *) 0x0
(gdb) wher
#0  0x0000555555a75e8c in st_select_lex::update_used_tables (this=0x7fff54012dc8)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_lex.cc:4217
#1  0x0000555555ac0024 in JOIN::optimize_inner (this=0x7fff54015780)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:1155
#2  0x0000555555abfc2c in JOIN::optimize (this=0x7fff54015780)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:1063
#3  0x0000555555ac7ed0 in mysql_select (thd=0x7fff54000b00, tables=0x7fff540139c0, wild_num=0, fields=..., conds=
    0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184068, 
    result=0x7fff54014890, unit=0x7fff54013160, select_lex=0x7fff54012dc8)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:3521
#4  0x0000555555afad29 in mysql_explain_union (thd=0x7fff54000b00, unit=0x7fff54013160, result=0x7fff54014890)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:24511
#5  0x0000555555afaa8e in select_describe (join=0x7fff54014f10, need_tmp_table=false, need_order=false, 
    distinct=false, message=0x0) at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:24466
#6  0x0000555555ac77a8 in JOIN::exec_inner (this=0x7fff54014f10)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:3313
#7  0x0000555555ac6e78 in JOIN::exec (this=0x7fff54014f10)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:3153
#8  0x0000555555ac7f60 in mysql_select (thd=0x7fff54000b00, tables=0x7fff54014198, wild_num=1, fields=..., 
    conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, 
    result=0x7fff54014890, unit=0x7fff54004550, select_lex=0x7fff54004c70)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:3535
#9  0x0000555555afad29 in mysql_explain_union (thd=0x7fff54000b00, unit=0x7fff54004550, result=0x7fff54014890)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_select.cc:24511
#10 0x0000555555a8d305 in execute_sqlcom_select (thd=0x7fff54000b00, all_tables=0x7fff54014198)
    at /home/psergey/dev-git/10.2-window-funcs-r10/sql/sql_parse.cc:6238



 Comments   
Comment by Sergei Petrunia [ 2016-08-09 ]

Fixed in the bb-10.2-mdev9864 tree.

Comment by Sergei Petrunia [ 2016-09-04 ]

That tree has now been merged into the main 10.2 tree.
Verified that the problem doesn't exist anymore.

Generated at Thu Feb 08 07:38:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.