[MDEV-20597] Assertion `item->type() == Item::FIELD_ITEM || (item->type() == Item::REF_ITEM && ((((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF) || (((Item_ref *) item)->ref_type() == Item_ref::REF)))' failed in get_corresponding_field_pair Created: 2019-09-16  Updated: 2020-09-30

Status: Confirmed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.4, 10.5
Fix Version/s: 10.4, 10.5

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


 Description   

CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
SELECT a FROM t1 GROUP BY a HAVING VALUE(a);
 
# Cleanup
DROP TABLE t1;

10.4 71c57bcf

mysqld: /data/src/10.4/sql/sql_lex.cc:9981: Field_pair* get_corresponding_field_pair(Item*, List<Field_pair>): Assertion `item->type() == Item::FIELD_ITEM || (item->type() == Item::REF_ITEM && ((((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF) || (((Item_ref *) item)->ref_type() == Item_ref::REF)))' failed.
190916  3:20:00 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f1e191e8f12 in __GI___assert_fail (assertion=0x559cffcab5b8 "item->type() == Item::FIELD_ITEM || (item->type() == Item::REF_ITEM && ((((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF) || (((Item_ref *) item)->ref_type() == Item_ref::REF)))", file=0x559cffcaa0e4 "/data/src/10.4/sql/sql_lex.cc", line=9981, function=0x559cffcadf60 <get_corresponding_field_pair(Item*, List<Field_pair>)::__PRETTY_FUNCTION__> "Field_pair* get_corresponding_field_pair(Item*, List<Field_pair>)") at assert.c:101
#8  0x0000559cfef61829 in get_corresponding_field_pair (item=0x7f1e000140e0, pair_list=...) at /data/src/10.4/sql/sql_lex.cc:9978
#9  0x0000559cff174549 in find_matching_field_pair (item=0x7f1e000140e0, pair_list=...) at /data/src/10.4/sql/opt_subselect.cc:6668
#10 0x0000559cff31c785 in Item_field::excl_dep_on_grouping_fields (this=0x7f1e000140e0, sel=0x7f1e000131d8) at /data/src/10.4/sql/item.cc:9103
#11 0x0000559cfef5b09d in st_select_lex::check_cond_extraction_for_grouping_fields (this=0x7f1e000131d8, thd=0x7f1e00000b00, cond=0x7f1e000140e0) at /data/src/10.4/sql/sql_lex.cc:7992
#12 0x0000559cfef61e39 in st_select_lex::pushdown_from_having_into_where (this=0x7f1e000131d8, thd=0x7f1e00000b00, having=0x7f1e000140e0) at /data/src/10.4/sql/sql_lex.cc:10202
#13 0x0000559cfefcbd5f in JOIN::optimize_inner (this=0x7f1e00014af8) at /data/src/10.4/sql/sql_select.cc:1967
#14 0x0000559cfefca68c in JOIN::optimize (this=0x7f1e00014af8) at /data/src/10.4/sql/sql_select.cc:1561
#15 0x0000559cfefd58b4 in mysql_select (thd=0x7f1e00000b00, tables=0x7f1e000137a0, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f1e00013f80, having=0x7f1e000140e0, proc_param=0x0, select_options=2147748608, result=0x7f1e00014ad0, unit=0x7f1e00004a30, select_lex=0x7f1e000131d8) at /data/src/10.4/sql/sql_select.cc:4590
#16 0x0000559cfefc572d in handle_select (thd=0x7f1e00000b00, lex=0x7f1e00004968, result=0x7f1e00014ad0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
#17 0x0000559cfef8ba08 in execute_sqlcom_select (thd=0x7f1e00000b00, all_tables=0x7f1e000137a0) at /data/src/10.4/sql/sql_parse.cc:6357
#18 0x0000559cfef80fb2 in mysql_execute_command (thd=0x7f1e00000b00) at /data/src/10.4/sql/sql_parse.cc:3899
#19 0x0000559cfef8fb52 in mysql_parse (thd=0x7f1e00000b00, rawbuf=0x7f1e00013118 "SELECT a FROM t1 GROUP BY a HAVING VALUE(a)", length=43, parser_state=0x7f1e133ba170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7909
#20 0x0000559cfef7ab52 in dispatch_command (command=COM_QUERY, thd=0x7f1e00000b00, packet=0x7f1e00008321 "SELECT a FROM t1 GROUP BY a HAVING VALUE(a)", packet_length=43, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
#21 0x0000559cfef7919c in do_command (thd=0x7f1e00000b00) at /data/src/10.4/sql/sql_parse.cc:1360
#22 0x0000559cff102f01 in do_handle_one_connection (connect=0x559d01bdfa80) at /data/src/10.4/sql/sql_connect.cc:1412
#23 0x0000559cff102c50 in handle_one_connection (arg=0x559d01bdfa80) at /data/src/10.4/sql/sql_connect.cc:1316
#24 0x0000559cffb3a4cd in pfs_spawn_thread (arg=0x559d01c43410) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#25 0x00007f1e1ad5d4a4 in start_thread (arg=0x7f1e133bb700) at pthread_create.c:456
#26 0x00007f1e192a5d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Reproducible with at least InnoDB, MyISAM, Aria.
No obvious problem on a non-debug build.



 Comments   
Comment by Igor Babaev [ 2020-04-18 ]

I reassigned it back because most probably this is a problem in Galina's code.

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