[MDEV-24593] Signal 11 when group by primary key of table joined to information_schema.columns Created: 2021-01-14  Updated: 2021-02-10  Resolved: 2021-01-22

Status: Closed
Project: MariaDB Server
Component/s: Information Schema
Affects Version/s: 10.3.27, 10.3, 10.4, 10.5
Fix Version/s: 10.3.28, 10.4.18, 10.5.9

Type: Bug Priority: Blocker
Reporter: Peter Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: regression
Environment:

Linux Redhat 7 (but running mariadb 10.3.27-MariaDB-log).


Issue Links:
Relates
relates to MDEV-24826 Query on users + information schema ... Closed

 Description   

Get signal 11, Error Code: 2013. Lost connection to MySQL server during query when do the following. This does not happen on 10.3.17 nor on 10.3.23. This only errors if col_name is the primary key in the example below.

To reproduce do the following:
create table test_crash(col_name varchar(64), primary key (col_name)); #only fails if col_name is a primary key

#fails on .27, works on .17 and .23
select d.col_name
from information_schema.columns i
inner join test_crash d on d.col_name=i.column_name
group by d.col_name;



 Comments   
Comment by Elena Stepanova [ 2021-01-14 ]

Thanks for the report. Reproducible as described.

create table test_crash(col_name varchar(64), primary key (col_name));
select d.col_name
from information_schema.columns i
inner join test_crash d on d.col_name=i.column_name
group by d.col_name;
 
drop table test_crash;

10.3 fb9a9599

#3  <signal handler called>
#4  ha_maria::scan_time (this=0x7f3e4c0ac9f8) at /data/src/10.3/storage/maria/ha_maria.cc:1062
#5  0x000056226de44c7c in SQL_SELECT::test_quick_select (this=0x7f3e4c018290, thd=0x7f3e4c000d90, keys_to_use=..., prev_tables=0, limit=18446744073709551615, force_quick_range=false, ordered_output=false, remove_false_parts_of_where=true) at /data/src/10.3/sql/opt_range.cc:2426
#6  0x000056226d9f4d6d in get_quick_record_count (thd=0x7f3e4c000d90, select=0x7f3e4c018290, table=0x7f3e4c036328, keys=0x7f3e4c016cd0, limit=18446744073709551615) at /data/src/10.3/sql/sql_select.cc:4356
#7  0x000056226d9f741e in make_join_statistics (join=0x7f3e4c0161d8, tables_list=..., keyuse_array=0x7f3e4c0164c8) at /data/src/10.3/sql/sql_select.cc:5061
#8  0x000056226d9ec478 in JOIN::optimize_inner (this=0x7f3e4c0161d8) at /data/src/10.3/sql/sql_select.cc:1955
#9  0x000056226d9ea99c in JOIN::optimize (this=0x7f3e4c0161d8) at /data/src/10.3/sql/sql_select.cc:1501
#10 0x000056226d9f4a90 in mysql_select (thd=0x7f3e4c000d90, tables=0x7f3e4c012db8, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f3e4c014718, having=0x0, proc_param=0x0, select_options=2684619520, result=0x7f3e4c0161b0, unit=0x7f3e4c004c58, select_lex=0x7f3e4c0053e0) at /data/src/10.3/sql/sql_select.cc:4305
#11 0x000056226d9e611a in handle_select (thd=0x7f3e4c000d90, lex=0x7f3e4c004b98, result=0x7f3e4c0161b0, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:370
#12 0x000056226d9ac7e0 in execute_sqlcom_select (thd=0x7f3e4c000d90, all_tables=0x7f3e4c012db8) at /data/src/10.3/sql/sql_parse.cc:6316
#13 0x000056226d9a2fed in mysql_execute_command (thd=0x7f3e4c000d90) at /data/src/10.3/sql/sql_parse.cc:3847
#14 0x000056226d9b0b64 in mysql_parse (thd=0x7f3e4c000d90, rawbuf=0x7f3e4c012ab8 "select d.col_name\nfrom information_schema.columns i\ninner join test_crash d on d.col_name=i.column_name\ngroup by d.col_name", length=123, parser_state=0x7f3e685415c0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7840
#15 0x000056226d99d2c8 in dispatch_command (command=COM_QUERY, thd=0x7f3e4c000d90, packet=0x7f3e4c008f11 "select d.col_name\nfrom information_schema.columns i\ninner join test_crash d on d.col_name=i.column_name\ngroup by d.col_name", packet_length=123, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
#16 0x000056226d99bc68 in do_command (thd=0x7f3e4c000d90) at /data/src/10.3/sql/sql_parse.cc:1398
#17 0x000056226db1a1a7 in do_handle_one_connection (connect=0x56226fbb2070) at /data/src/10.3/sql/sql_connect.cc:1403
#18 0x000056226db19f03 in handle_one_connection (arg=0x56226fbb2070) at /data/src/10.3/sql/sql_connect.cc:1308
#19 0x000056226e4e5d95 in pfs_spawn_thread (arg=0x56226fb95440) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#20 0x00007f3e6e22b609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x00007f3e6de07293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

The failure appeared after this commit:

commit e64084d5a3a72462fa6263d1d0a86e72c0ba0d47
Author: Sergei Golubchik
Date:   Sat Aug 1 13:12:50 2020 +0200
 
    MDEV-21201 No records produced in information_schema query, depending on projection

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