[MDEV-20622] Server crashes in embedding_sjm with HAVING and ROLLUP on constant table Created: 2019-09-18  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Igor Babaev
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-30215 WITH ROLLUP and HAVING make mysql ser... Closed
is duplicated by MDEV-32133 Server crash in embedding_sjm Closed

 Description   

CREATE TABLE t1 (a VARCHAR(3)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('foo');
SELECT a FROM t1 GROUP BY a WITH ROLLUP HAVING a = 'bar';

10.4 efefafd0

#3  <signal handler called>
#4  0x0000564e0e83a9ec in embedding_sjm (item=0x7f1518013ff8) at /data/src/10.4/sql/sql_select.cc:15251
#5  0x0000564e0e83ae72 in eliminate_item_equal (thd=0x7f1518000b00, cond=0x0, upper_levels=0x0, item_equal=0x7f1518015640) at /data/src/10.4/sql/sql_select.cc:15367
#6  0x0000564e0e83bab6 in substitute_for_best_equal_field (thd=0x7f1518000b00, context_tab=0x1, cond=0x7f1518015640, cond_equal=0x0, table_join_idx=0x7f1518015c00, do_substitution=false) at /data/src/10.4/sql/sql_select.cc:15672
#7  0x0000564e0e814b91 in JOIN::optimize_stage2 (this=0x7f1518014cd8) at /data/src/10.4/sql/sql_select.cc:2351
#8  0x0000564e0e814279 in JOIN::optimize_inner (this=0x7f1518014cd8) at /data/src/10.4/sql/sql_select.cc:2218
#9  0x0000564e0e811d5e in JOIN::optimize (this=0x7f1518014cd8) at /data/src/10.4/sql/sql_select.cc:1561
#10 0x0000564e0e81cf86 in mysql_select (thd=0x7f1518000b00, tables=0x7f15180137b8, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f1518013f98, having=0x7f1518014198, proc_param=0x0, select_options=2147748608, result=0x7f1518014cb0, unit=0x7f1518004a30, select_lex=0x7f15180131f0) at /data/src/10.4/sql/sql_select.cc:4590
#11 0x0000564e0e80cdff in handle_select (thd=0x7f1518000b00, lex=0x7f1518004968, result=0x7f1518014cb0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
#12 0x0000564e0e7d308a in execute_sqlcom_select (thd=0x7f1518000b00, all_tables=0x7f15180137b8) at /data/src/10.4/sql/sql_parse.cc:6352
#13 0x0000564e0e7c8634 in mysql_execute_command (thd=0x7f1518000b00) at /data/src/10.4/sql/sql_parse.cc:3894
#14 0x0000564e0e7d7225 in mysql_parse (thd=0x7f1518000b00, rawbuf=0x7f1518013118 "SELECT a FROM t1 GROUP BY a WITH ROLLUP HAVING a = 'bar'", length=56, parser_state=0x7f1529016170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7912
#15 0x0000564e0e7c2178 in dispatch_command (command=COM_QUERY, thd=0x7f1518000b00, packet=0x7f1518008321 "SELECT a FROM t1 GROUP BY a WITH ROLLUP HAVING a = 'bar'", packet_length=56, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1841
#16 0x0000564e0e7c07dc in do_command (thd=0x7f1518000b00) at /data/src/10.4/sql/sql_parse.cc:1359
#17 0x0000564e0e94a7ad in do_handle_one_connection (connect=0x564e12455f40) at /data/src/10.4/sql/sql_connect.cc:1412
#18 0x0000564e0e94a4fc in handle_one_connection (arg=0x564e12455f40) at /data/src/10.4/sql/sql_connect.cc:1316
#19 0x0000564e0f382093 in pfs_spawn_thread (arg=0x564e1248b350) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#20 0x00007f15309b94a4 in start_thread (arg=0x7f1529017700) at pthread_create.c:456
#21 0x00007f152ef01d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Same crash on all of debug, ASAN, non-debug.
Couldn't reproduce on 10.3.


Generated at Thu Feb 08 09:00:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.