[MDEV-19048] Assertion `ctx.compare_type_handler()->cmp_type() != STRING_RESULT' failed in Field_num::get_equal_zerofill_const_item Created: 2019-03-26  Updated: 2019-04-05  Resolved: 2019-04-05

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.4
Fix Version/s: 10.4.4

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Galina Shalygina (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
is part of MDEV-18769 Assertion `fixed == 1' failed in Item... Closed

 Description   

CREATE TABLE t1 (a INT ZEROFILL, b INT, c INT);
INSERT INTO t1 VALUES (1,2,3),(4,5,6);
SELECT a, b, c FROM t1 GROUP BY a, b, c HAVING (a = 5 OR c <> 0) AND b < 9;

10.4 c0ba036b

mysqld: /data/src/10.4/sql/field.cc:1420: Item* Field_num::get_equal_zerofill_const_item(THD*, const Value_source::Context&, Item*): Assertion `ctx.compare_type_handler()->cmp_type() != STRING_RESULT' failed.
190326  2:36:48 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f835b773ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000564a52a88116 in Field_num::get_equal_zerofill_const_item (this=0x7f8344128a50, thd=0x7f8344000b00, ctx=..., const_item=0x7f8344018f60) at /data/src/10.4/sql/field.cc:1420
#9  0x0000564a52ab4535 in Field_num::get_equal_const_item (this=0x7f8344128a50, thd=0x7f8344000b00, ctx=..., const_item=0x7f8344018f60) at /data/src/10.4/sql/field.h:1779
#10 0x0000564a527ef958 in check_simple_equality (thd=0x7f8344000b00, ctx=..., left_item=0x7f8344018ff0, right_item=0x7f8344018f60, cond_equal=0x7f83558ebb00) at /data/src/10.4/sql/sql_select.cc:14416
#11 0x0000564a5296077a in and_new_conditions_to_optimized_cond (thd=0x7f8344000b00, cond=0x0, cond_eq=0x7f83558ebbb0, new_conds=..., cond_value=0x7f83558ebba4, build_cond_equal=false) at /data/src/10.4/sql/opt_subselect.cc:5658
#12 0x0000564a52af7e60 in Item::build_pushable_cond (this=0x7f8344018ca0, thd=0x7f8344000b00, checker=(bool (Item::*)(Item * const, uchar *)) 0x564a52af8966 <Item::pushable_equality_checker_for_having_pushdown(unsigned char*)>, arg=0x7f83440156d8 "") at /data/src/10.4/sql/item.cc:7321
#13 0x0000564a52af7c2a in Item::build_pushable_cond (this=0x7f83440171b0, thd=0x7f8344000b00, checker=(bool (Item::*)(Item * const, uchar *)) 0x564a52af8966 <Item::pushable_equality_checker_for_having_pushdown(unsigned char*)>, arg=0x7f83440156d8 "") at /data/src/10.4/sql/item.cc:7277
#14 0x0000564a52765072 in st_select_lex::build_pushable_cond_for_having_pushdown (this=0x7f83440156d8, thd=0x7f8344000b00, cond=0x7f8344017698) at /data/src/10.4/sql/sql_lex.cc:9853
#15 0x0000564a52765cc0 in st_select_lex::pushdown_from_having_into_where (this=0x7f83440156d8, thd=0x7f8344000b00, having=0x7f8344017698) at /data/src/10.4/sql/sql_lex.cc:10160
#16 0x0000564a527cb366 in JOIN::optimize_inner (this=0x7f83440180c0) at /data/src/10.4/sql/sql_select.cc:1946
#17 0x0000564a527c9d1c in JOIN::optimize (this=0x7f83440180c0) at /data/src/10.4/sql/sql_select.cc:1551
#18 0x0000564a527d4c28 in mysql_select (thd=0x7f8344000b00, tables=0x7f8344015ee8, wild_num=0, fields=..., conds=0x0, og_num=3, order=0x0, group=0x7f83440166c0, having=0x7f8344017698, proc_param=0x0, select_options=2147748608, result=0x7f8344018098, unit=0x7f8344004a20, select_lex=0x7f83440156d8) at /data/src/10.4/sql/sql_select.cc:4571
#19 0x0000564a527c523c in handle_select (thd=0x7f8344000b00, lex=0x7f8344004958, result=0x7f8344018098, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
#20 0x0000564a5278e665 in execute_sqlcom_select (thd=0x7f8344000b00, all_tables=0x7f8344015ee8) at /data/src/10.4/sql/sql_parse.cc:6601
#21 0x0000564a52783b37 in mysql_execute_command (thd=0x7f8344000b00) at /data/src/10.4/sql/sql_parse.cc:3889
#22 0x0000564a527925a5 in mysql_parse (thd=0x7f8344000b00, rawbuf=0x7f83440155d8 "SELECT a, b, c FROM t1 GROUP BY a, b, c HAVING (a = 5 OR c <> 0) AND b < 9", length=74, parser_state=0x7f83558ed180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
#23 0x0000564a5277dd1a in dispatch_command (command=COM_QUERY, thd=0x7f8344000b00, packet=0x7f8344139261 "SELECT a, b, c FROM t1 GROUP BY a, b, c HAVING (a = 5 OR c <> 0) AND b < 9", packet_length=74, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
#24 0x0000564a5277c500 in do_command (thd=0x7f8344000b00) at /data/src/10.4/sql/sql_parse.cc:1365
#25 0x0000564a528f6611 in do_handle_one_connection (connect=0x564a55aa64e0) at /data/src/10.4/sql/sql_connect.cc:1398
#26 0x0000564a528f6382 in handle_one_connection (arg=0x564a55aa64e0) at /data/src/10.4/sql/sql_connect.cc:1301
#27 0x0000564a52dec421 in pfs_spawn_thread (arg=0x564a55b988d0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#28 0x00007f835d662494 in start_thread (arg=0x7f83558ee700) at pthread_create.c:333
#29 0x00007f835b83093f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Reproducible with at least MyISAM, InnoDB, Aria.
Not reproducible with condition_pushdown_from_having=off.
No obvious problem on a non-debug build.



 Comments   
Comment by Galina Shalygina (Inactive) [ 2019-04-05 ]

Fixed in MDEV-18769

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