[MDEV-17830] Server crashes in Item_null_result::field_type upon SELECT with CHARSET(date) and ROLLUP Created: 2018-11-25  Updated: 2020-06-02  Resolved: 2019-04-17

Status: Closed
Project: MariaDB Server
Component/s: Stored routines, Temporal Types
Affects Version/s: 10.1, 10.2
Fix Version/s: 10.2.24, 10.1.39

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-16190 Server crashes in Item_null_result::f... Closed
relates to MDEV-19271 CHARSET(column) returns different res... Open
relates to MDEV-22772 Server crashes in Item_null_result::f... Closed

 Description   

CREATE TABLE t (d DATE) ENGINE=MyISAM;
INSERT INTO t VALUES ('2018-12-12');
SELECT CHARSET(d) AS f FROM t GROUP BY d WITH ROLLUP; 
 
# Cleanup
DROP TABLE t;

10.1 8324e5e84dc

#3  <signal handler called>
#4  0x0000555e4ffb80e7 in Item_null_result::field_type (this=0x7f4408445d98) at /data/src/10.1/sql/item.h:2612
#5  0x0000555e4fedfe23 in Item_ref::field_type (this=0x7f4408444368) at /data/src/10.1/sql/item.h:3939
#6  0x0000555e5018c777 in Item::cmp_type (this=0x7f4408444368) at /data/src/10.1/sql/item.cc:658
#7  0x0000555e4fe83287 in Item::charset_for_protocol (this=0x7f4408444368) at /data/src/10.1/sql/item.h:1374
#8  0x0000555e502110cd in Item_func_charset::val_str (this=0x7f4408443268, str=0x7f4412eecdd0) at /data/src/10.1/sql/item_strfunc.cc:3439
#9  0x0000555e5019bc3f in Item::send (this=0x7f4408443268, protocol=0x7f440a0d5600, buffer=0x7f4412eecdd0) at /data/src/10.1/sql/item.cc:6398
#10 0x0000555e4fe80154 in Protocol::send_result_set_row (this=0x7f440a0d5600, row_items=0x7f4408444298) at /data/src/10.1/sql/protocol.cc:914
#11 0x0000555e4fef881a in select_send::send_data (this=0x7f4408443ba0, items=...) at /data/src/10.1/sql/sql_class.cc:2747
#12 0x0000555e4ffb017f in JOIN::rollup_send_data (this=0x7f4408443bc0, idx=0) at /data/src/10.1/sql/sql_select.cc:24032
#13 0x0000555e4ffa5c62 in end_send_group (join=0x7f4408443bc0, join_tab=0x0, end_of_records=true) at /data/src/10.1/sql/sql_select.cc:19769
#14 0x0000555e4ffa213e in do_select (join=0x7f4408443bc0, fields=0x7f4408443fc0, table=0x0, procedure=0x0) at /data/src/10.1/sql/sql_select.cc:18093
#15 0x0000555e4ff7cbac in JOIN::exec_inner (this=0x7f4408443bc0) at /data/src/10.1/sql/sql_select.cc:3275
#16 0x0000555e4ff79e3d in JOIN::exec (this=0x7f4408443bc0) at /data/src/10.1/sql/sql_select.cc:2562
#17 0x0000555e4ff7d3d3 in mysql_select (thd=0x7f440a0d5070, rref_pointer_array=0x7f440a0d9550, tables=0x7f4408443380, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f4408443a88, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f4408443ba0, unit=0x7f440a0d8ba8, select_lex=0x7f440a0d92a8) at /data/src/10.1/sql/sql_select.cc:3499
#18 0x0000555e4ff72a8c in handle_select (thd=0x7f440a0d5070, lex=0x7f440a0d8ae0, result=0x7f4408443ba0, setup_tables_done_option=0) at /data/src/10.1/sql/sql_select.cc:388
#19 0x0000555e4ff4241b in execute_sqlcom_select (thd=0x7f440a0d5070, all_tables=0x7f4408443380) at /data/src/10.1/sql/sql_parse.cc:5948
#20 0x0000555e4ff387ef in mysql_execute_command (thd=0x7f440a0d5070) at /data/src/10.1/sql/sql_parse.cc:2993
#21 0x0000555e4ff4605f in mysql_parse (thd=0x7f440a0d5070, rawbuf=0x7f4408443088 "SELECT CHARSET(d) AS f FROM t GROUP BY d WITH ROLLUP", length=52, parser_state=0x7f4412eee5e0) at /data/src/10.1/sql/sql_parse.cc:7466
#22 0x0000555e4ff348c0 in dispatch_command (command=COM_QUERY, thd=0x7f440a0d5070, packet=0x7f440cbf9071 "", packet_length=52) at /data/src/10.1/sql/sql_parse.cc:1495
#23 0x0000555e4ff33645 in do_command (thd=0x7f440a0d5070) at /data/src/10.1/sql/sql_parse.cc:1124
#24 0x0000555e5006e194 in do_handle_one_connection (thd_arg=0x7f440a0d5070) at /data/src/10.1/sql/sql_connect.cc:1330
#25 0x0000555e5006def8 in handle_one_connection (arg=0x7f440a0d5070) at /data/src/10.1/sql/sql_connect.cc:1242
#26 0x0000555e5042c15e in pfs_spawn_thread (arg=0x7f4410839ef0) at /data/src/10.1/storage/perfschema/pfs.cc:1861
#27 0x00007f4412b6e494 in start_thread (arg=0x7f4412eefb00) at pthread_create.c:333
#28 0x00007f441114293f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Reproducible on 10.1 and 10.2, debug and non-debug builds, at least MyISAM and Aria.
Not reproducible on 10.3 or 10.4.


Generated at Thu Feb 08 08:39:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.