[MDEV-12554] Server crashes in st_select_lex_unit::exec_recursive on recursive CTE with impossible condition Created: 2017-04-21  Updated: 2017-04-24  Resolved: 2017-04-24

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - CTE
Affects Version/s: 10.2
Fix Version/s: 10.2.6

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: 10.2-ga


 Description   

54a995cd2206995f6dd675cabdce12a4b7ff7540

#3  <signal handler called>
#4  0x00007f88b7960ee4 in st_select_lex_unit::exec_recursive (this=0x7f88940128f0) at /data/src/10.2/sql/sql_union.cc:1265
#5  0x00007f88b784cdf8 in TABLE_LIST::fill_recursive (this=0x7f8894014f90, thd=0x7f8894000b00) at /data/src/10.2/sql/sql_derived.cc:973
#6  0x00007f88b784cfdc in mysql_derived_fill (thd=0x7f8894000b00, lex=0x7f8894004518, derived=0x7f8894014f90) at /data/src/10.2/sql/sql_derived.cc:1037
#7  0x00007f88b784b482 in mysql_handle_single_derived (lex=0x7f8894004518, derived=0x7f8894014f90, phases=96) at /data/src/10.2/sql/sql_derived.cc:197
#8  0x00007f88b78d99b5 in st_join_table::preread_init (this=0x7f889403bbe0) at /data/src/10.2/sql/sql_select.cc:11756
#9  0x00007f88b78e9a01 in sub_select (join=0x7f88940156b8, join_tab=0x7f889403bbe0, end_of_records=false) at /data/src/10.2/sql/sql_select.cc:18426
#10 0x00007f88b78e9137 in do_select (join=0x7f88940156b8, procedure=0x0) at /data/src/10.2/sql/sql_select.cc:18002
#11 0x00007f88b78c3d61 in JOIN::exec_inner (this=0x7f88940156b8) at /data/src/10.2/sql/sql_select.cc:3464
#12 0x00007f88b78c3266 in JOIN::exec (this=0x7f88940156b8) at /data/src/10.2/sql/sql_select.cc:3267
#13 0x00007f88b78c43d9 in mysql_select (thd=0x7f8894000b00, tables=0x7f8894014f90, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f8894015698, unit=0x7f88940045e0, select_lex=0x7f8894004d10) at /data/src/10.2/sql/sql_select.cc:3659
#14 0x00007f88b78b8ea2 in handle_select (thd=0x7f8894000b00, lex=0x7f8894004518, result=0x7f8894015698, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:373
#15 0x00007f88b7885223 in execute_sqlcom_select (thd=0x7f8894000b00, all_tables=0x7f8894014f90) at /data/src/10.2/sql/sql_parse.cc:6431
#16 0x00007f88b787b262 in mysql_execute_command (thd=0x7f8894000b00) at /data/src/10.2/sql/sql_parse.cc:3448
#17 0x00007f88b7888bf6 in mysql_parse (thd=0x7f8894000b00, rawbuf=0x7f8894012348 "WITH RECURSIVE cte(f) AS ( SELECT i FROM t UNION SELECT f FROM t, cte WHERE 0 ) SELECT * FROM cte", length=97, parser_state=0x7f88b007d210, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7874
#18 0x00007f88b7876cce in dispatch_command (command=COM_QUERY, thd=0x7f8894000b00, packet=0x7f88940087a1 "", packet_length=97, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1812
#19 0x00007f88b787563e in do_command (thd=0x7f8894000b00) at /data/src/10.2/sql/sql_parse.cc:1362
#20 0x00007f88b79bfe05 in do_handle_one_connection (connect=0x7f88bac72260) at /data/src/10.2/sql/sql_connect.cc:1354
#21 0x00007f88b79bfb92 in handle_one_connection (arg=0x7f88bac72260) at /data/src/10.2/sql/sql_connect.cc:1260
#22 0x00007f88b7dd8eb8 in pfs_spawn_thread (arg=0x7f88bac4cb10) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#23 0x00007f88b6e9b064 in start_thread (arg=0x7f88b007e700) at pthread_create.c:309
#24 0x00007f88b528b62d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

CREATE TABLE t (i INT);
INSERT INTO t VALUES (1),(2); # optional, fails either way
 
WITH RECURSIVE cte(f) AS ( SELECT i FROM t UNION SELECT f FROM t, cte WHERE 0 ) SELECT * FROM cte;



 Comments   
Comment by Igor Babaev [ 2017-04-24 ]

The fix for this bug was pushed into the 10.2 tree.

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