[MDEV-16720]  Assertion `used_tables_cache == 0' failed. Created: 2018-07-10  Updated: 2021-05-11  Resolved: 2019-01-02

Status: Closed
Project: MariaDB Server
Component/s: N/A
Affects Version/s: 10.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-16717 Item_func_eq::val_int(): Assertion `f... Closed
relates to MDEV-25650 Assertion `used_tables_cache == 0' fa... Open

 Description   

CREATE TABLE `t1` (
  `v3` varchar(10) ,
  `v2` varchar(10) CHARACTER SET utf8 ,
  `v1` varchar(1024) CHARACTER SET utf8 
);
 
CREATE TABLE `t2` (
  `v2` varchar(10) CHARACTER SET utf8 ,
  `v3` varchar(10) ,
  `v1` varchar(1024) CHARACTER SET utf8 ,
  KEY `v2` (`v2`)
);
 
INSERT INTO `t1` VALUES ('a','i','q'), ('bt1f','aim','rtr');
INSERT INTO `t2` VALUES ('xfvihcvywh','joint','evolsbve'),('gsh','q','hcvywhcmxldkfmnjug');
 
SELECT 1 FROM t1
WHERE (t1.v1 IN (SELECT MAX(v2) FROM t2))
  AND t1.v2 < 'm' AND t1.v3 LIKE 'b%';

10.4 29da7a1a9ab5033f17e8550237

Thread 1 (Thread 0x7efc06066700 (LWP 2081)):
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1  0x0000555567237761 in my_write_core (sig=6) at /home/alice/git/10.4/mysys/stacktrace.c:481
#2  0x0000555566a7a0d1 in handle_fatal_signal (sig=6) at /home/alice/git/10.4/sql/signal_handler.cc:305
#3  <signal handler called>
#4  0x00007efc0bec8428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007efc0beca02a in __GI_abort () at abort.c:89
#6  0x00007efc0bec0bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x555567477264 "used_tables_cache == 0", file=file@entry=0x555567477230 "/home/alice/git/10.4/sql/item_func.cc", line=line@entry=340, function=function@entry=0x5555674780c0 <Item_func::fix_fields(THD*, Item**)::__PRETTY_FUNCTION__> "virtual bool Item_func::fix_fields(THD*, Item**)") at assert.c:92
#7  0x00007efc0bec0c82 in __GI___assert_fail (assertion=0x555567477264 "used_tables_cache == 0", file=0x555567477230 "/home/alice/git/10.4/sql/item_func.cc", line=340, function=0x5555674780c0 <Item_func::fix_fields(THD*, Item**)::__PRETTY_FUNCTION__> "virtual bool Item_func::fix_fields(THD*, Item**)") at assert.c:101
#8  0x0000555566afbec5 in Item_func::fix_fields (this=0x7efbf401a5b8, thd=0x7efbf4000b00, ref=0x7efbf401ae48) at /home/alice/git/10.4/sql/item_func.cc:340
#9  0x000055556668d74f in Item::fix_fields_if_needed (this=0x7efbf401a5b8, thd=0x7efbf4000b00, ref=0x7efbf401ae48) at /home/alice/git/10.4/sql/item.h:933
#10 0x000055556668d77d in Item::fix_fields_if_needed_for_scalar (this=0x7efbf401a5b8, thd=0x7efbf4000b00, ref=0x7efbf401ae48) at /home/alice/git/10.4/sql/item.h:937
#11 0x0000555566706f9b in Item::fix_fields_if_needed_for_bool (this=0x7efbf401a5b8, thd=0x7efbf4000b00, ref=0x7efbf401ae48) at /home/alice/git/10.4/sql/item.h:941
#12 0x0000555566aca7b9 in Item_cond::fix_fields (this=0x7efbf401ad08, thd=0x7efbf4000b00, ref=0x0) at /home/alice/git/10.4/sql/item_cmpfunc.cc:4612
#13 0x0000555566803e76 in make_cond_for_table_from_pred (thd=0x7efbf4000b00, root_cond=0x7efbf4017698, cond=0x7efbf4017698, tables=13835058055282163715, used_table=9223372036854775809, join_tab_idx_arg=1, exclude_expensive_cond=false, retain_ref_cond=false) at /home/alice/git/10.4/sql/sql_select.cc:21127
#14 0x0000555566803c20 in make_cond_for_table (thd=0x7efbf4000b00, cond=0x7efbf4017698, tables=13835058055282163715, used_table=9223372036854775809, join_tab_idx_arg=1, exclude_expensive_cond=false, retain_ref_cond=false) at /home/alice/git/10.4/sql/sql_select.cc:21080
#15 0x00005555667e8dc4 in make_join_select (join=0x7efbf4018428, select=0x7efbf401aa20, cond=0x7efbf4017698) at /home/alice/git/10.4/sql/sql_select.cc:10535
#16 0x00005555667d0aa9 in JOIN::optimize_stage2 (this=0x7efbf4018428) at /home/alice/git/10.4/sql/sql_select.cc:2180
#17 0x00005555667cfbcb in JOIN::optimize_inner (this=0x7efbf4018428) at /home/alice/git/10.4/sql/sql_select.cc:1952
#18 0x00005555667cdf33 in JOIN::optimize (this=0x7efbf4018428) at /home/alice/git/10.4/sql/sql_select.cc:1448
#19 0x00005555667d7e43 in mysql_select (thd=0x7efbf4000b00, tables=0x7efbf40154b8, wild_num=0, fields=..., conds=0x7efbf4017698, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7efbf4018408, unit=0x7efbf40049a8, select_lex=0x7efbf4014fa8) at /home/alice/git/10.4/sql/sql_select.cc:4261
#20 0x00005555667c99d6 in handle_select (thd=0x7efbf4000b00, lex=0x7efbf40048e0, result=0x7efbf4018408, setup_tables_done_option=0) at /home/alice/git/10.4/sql/sql_select.cc:382
#21 0x0000555566794315 in execute_sqlcom_select (thd=0x7efbf4000b00, all_tables=0x7efbf40154b8) at /home/alice/git/10.4/sql/sql_parse.cc:6545
#22 0x000055556678a76e in mysql_execute_command (thd=0x7efbf4000b00) at /home/alice/git/10.4/sql/sql_parse.cc:3768
#23 0x000055556679804d in mysql_parse (thd=0x7efbf4000b00, rawbuf=0x7efbf4014e88 "SELECT 1 FROM t1\nWHERE (t1.v1 IN (SELECT MAX(v2) FROM t2))\nAND t1.v2 < 'm' AND t1.v3 LIKE 'b%'", length=94, parser_state=0x7efc060655f0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.4/sql/sql_parse.cc:8063
#24 0x00005555667851d0 in dispatch_command (command=COM_QUERY, thd=0x7efbf4000b00, packet=0x7efbf400b441 "SELECT 1 FROM t1\nWHERE (t1.v1 IN (SELECT MAX(v2) FROM t2))\nAND t1.v2 < 'm' AND t1.v3 LIKE 'b%'", packet_length=94, is_com_multi=false, is_next_command=false) at /home/alice/git/10.4/sql/sql_parse.cc:1847
#25 0x0000555566783bed in do_command (thd=0x7efbf4000b00) at /home/alice/git/10.4/sql/sql_parse.cc:1392
#26 0x00005555668ea613 in do_handle_one_connection (connect=0x555569630b20) at /home/alice/git/10.4/sql/sql_connect.cc:1402
#27 0x00005555668ea364 in handle_one_connection (arg=0x555569630b20) at /home/alice/git/10.4/sql/sql_connect.cc:1308
#28 0x00005555671c7baa in pfs_spawn_thread (arg=0x555569638c10) at /home/alice/git/10.4/storage/perfschema/pfs.cc:1862
#29 0x00007efc0cb056ba in start_thread (arg=0x7efc06066700) at pthread_create.c:333
#30 0x00007efc0bf9a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109



 Comments   
Comment by Alice Sherepa [ 2019-01-02 ]

not reproducible on 10.4 2465d3e00b2f18c7d4967, fixed earlier

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