[MDEV-31198] Server crash instead of ER_CANT_AGGREGATE_2COLLATIONS on 2nd execution of PS Created: 2023-05-05  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Character Sets, Prepared Statements
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.8, 10.9, 10.10, 10.11, 11.0
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Dmitry Shulga
Resolution: Unresolved Votes: 0
Labels: None


 Description   

CREATE TABLE t1 (a INT, b VARCHAR(64)) ENGINE=MyISAM COLLATE=utf8_unicode_ci;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
 
CREATE TABLE t2 (c INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(2);
CREATE VIEW v2 AS SELECT * FROM t2;
 
CREATE TABLE t3 (d VARCHAR(64)) ENGINE=MyISAM COLLATE=utf8_general_ci;
INSERT INTO t3 VALUES ('baz'),('qux');
 
PREPARE stmt FROM 'SELECT * FROM t1 LEFT JOIN v2 ON (v2.c = t1.a) WHERE t1.b IN (SELECT d FROM t3)';
 
--error ER_CANT_AGGREGATE_2COLLATIONS
EXECUTE stmt;
--error ER_CANT_AGGREGATE_2COLLATIONS
EXECUTE stmt;
 
# Cleanup
DROP VIEW v2;
DROP TABLE t1, t2, t3;

10.3 55a53949

#3  <signal handler called>
#4  0x000056280e27cb6f in st_select_lex::update_used_tables (this=0x62b000031ab8) at /data/src/10.3/sql/sql_lex.cc:4485
#5  0x000056280e384553 in JOIN::optimize_inner (this=0x62b0000004e0) at /data/src/10.3/sql/sql_select.cc:1633
#6  0x000056280e383886 in JOIN::optimize (this=0x62b0000004e0) at /data/src/10.3/sql/sql_select.cc:1542
#7  0x000056280e3a0ef1 in mysql_select (thd=0x62a000060208, tables=0x62b000032c90, wild_num=0, fields=..., conds=0x62b000035bb0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x62b000035e18, unit=0x62b0000312f8, select_lex=0x62b000031ab8) at /data/src/10.3/sql/sql_select.cc:4379
#8  0x000056280e37705b in handle_select (thd=0x62a000060208, lex=0x62b000031238, result=0x62b000035e18, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:372
#9  0x000056280e2eb6e6 in execute_sqlcom_select (thd=0x62a000060208, all_tables=0x62b000032c90) at /data/src/10.3/sql/sql_parse.cc:6340
#10 0x000056280e2d94b7 in mysql_execute_command (thd=0x62a000060208) at /data/src/10.3/sql/sql_parse.cc:3871
#11 0x000056280e345b29 in Prepared_statement::execute (this=0x619000085788, expanded_query=0x7f18100d7dd0, open_cursor=false) at /data/src/10.3/sql/sql_prepare.cc:5029
#12 0x000056280e340f58 in Prepared_statement::execute_loop (this=0x619000085788, expanded_query=0x7f18100d7dd0, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.3/sql/sql_prepare.cc:4457
#13 0x000056280e33b148 in mysql_sql_stmt_execute (thd=0x62a000060208) at /data/src/10.3/sql/sql_prepare.cc:3545
#14 0x000056280e2d94fc in mysql_execute_command (thd=0x62a000060208) at /data/src/10.3/sql/sql_parse.cc:3887
#15 0x000056280e2f5180 in mysql_parse (thd=0x62a000060208, rawbuf=0x62b000000228 "EXECUTE stmt", length=12, parser_state=0x7f18100d99b0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7855
#16 0x000056280e2cbfaf in dispatch_command (command=COM_QUERY, thd=0x62a000060208, packet=0x6290000dc209 "EXECUTE stmt", packet_length=12, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
#17 0x000056280e2c8b47 in do_command (thd=0x62a000060208) at /data/src/10.3/sql/sql_parse.cc:1398
#18 0x000056280e690f5c in do_handle_one_connection (connect=0x6080000006a8) at /data/src/10.3/sql/sql_connect.cc:1404
#19 0x000056280e690889 in handle_one_connection (arg=0x6080000006a8) at /data/src/10.3/sql/sql_connect.cc:1309
#20 0x000056280fc77bd5 in pfs_spawn_thread (arg=0x615000003008) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#21 0x00007f1819087fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#22 0x00007f18191085bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Reproducible on debug- and non-debug builds alike, with at least MyISAM, InnoDB, Aria, on all existing versions, including earlier minor releases.


Generated at Thu Feb 08 10:22:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.