Bug #34800 Assertion failed: !table || (!table->read_set || bitmap_is_set(table->read_set,
Submitted: 25 Feb 2008 9:06 Modified: 10 Jan 2013 11:22
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S6 (Debug Builds)
Version:6.0.3-debug/6.0BK OS:Any
Assigned to: CPU Architecture:Any

[25 Feb 2008 9:06] Shane Bester
Description:
query in how to repeat causes debug assertion with debug binary:

Version: '6.0.3-alpha-community-debug'  socket: ''  port: 3306  MySQL Community Server - Debug (GPL)
Assertion failed: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index)), file .\field.cc, line 6396

mysqld-debug.exe!_NMSG_WRITE
mysqld-debug.exe!abort
mysqld-debug.exe!_assert
mysqld-debug.exe!Field_string::val_str
mysqld-debug.exe!Item_field::val_str
mysqld-debug.exe!Item_func_geometry_from_text::val_str
mysqld-debug.exe!Arg_comparator::compare_string
mysqld-debug.exe!Arg_comparator::compare
mysqld-debug.exe!Item_func_gt::val_int
mysqld-debug.exe!Item::val_bool
mysqld-debug.exe!Item_cond_or::val_int
mysqld-debug.exe!Item_func_trig_cond::val_int
mysqld-debug.exe!evaluate_join_record
mysqld-debug.exe!sub_select
mysqld-debug.exe!do_select
mysqld-debug.exe!JOIN::exec
mysqld-debug.exe!subselect_single_select_engine::exec
mysqld-debug.exe!Item_subselect::exec
mysqld-debug.exe!Item_in_subselect::val_bool
mysqld-debug.exe!Item::val_bool_result
mysqld-debug.exe!Item_in_optimizer::val_int
mysqld-debug.exe!Item_func_nop_all::val_int
mysqld-debug.exe!Item::val_bool
mysqld-debug.exe!Item_cond_and::val_int
mysqld-debug.exe!evaluate_join_record
mysqld-debug.exe!sub_select
mysqld-debug.exe!do_select
mysqld-debug.exe!JOIN::exec
mysqld-debug.exe!mysql_select
mysqld-debug.exe!handle_select
mysqld-debug.exe!execute_sqlcom_select
mysqld-debug.exe!mysql_execute_command
mysqld-debug.exe!mysql_parse
mysqld-debug.exe!dispatch_command
mysqld-debug.exe!do_command
mysqld-debug.exe!handle_one_connection
mysqld-debug.exe!pthread_start
mysqld-debug.exe!_threadstart

i cannot repeat this on 5.0 or 5.1, so i believe its a new bug in 6.0 codebase.

How to repeat:
drop table if exists `t1`;
drop table if exists `t2`;

create table `t2`(`c1` char(78),key (`c1`))engine=myisam;
insert into `t2` values (null);
insert into `t2` values ('hi there');

create table `t1`(`c2` smallint,`c3` char(10),key (`c2`))engine=myisam;
insert into `t1` values (1,'test');
insert into `t1` values (2,'hi');

select  1 from `t2` where 
`c1` > any (select mpointfromtext(`c3`) from `t1` where `c2` <=1 )and
`c1` > any (select mpointfromtext(`c3`) from `t1`);
[25 Feb 2008 12:07] MySQL Verification Team
Thank you for the bug report. Verified on both main and team tree:

[miguel@mira 6.0]$ bin/mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.5-alpha-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> drop table if exists `t1`;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> drop table if exists `t2`;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> 
mysql> create table `t2`(`c1` char(78),key (`c1`))engine=myisam;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into `t2` values (null);
Query OK, 1 row affected (0.02 sec)

mysql> insert into `t2` values ('hi there');
Query OK, 1 row affected (0.00 sec)

mysql> 
mysql> create table `t1`(`c2` smallint,`c3` char(10),key (`c2`))engine=myisam;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into `t1` values (1,'test');
Query OK, 1 row affected (0.01 sec)

mysql> insert into `t1` values (2,'hi');
Query OK, 1 row affected (0.00 sec)

mysql> 
mysql> select  1 from `t2` where 
    -> `c1` > any (select mpointfromtext(`c3`) from `t1` where `c2` <=1 )and
    -> `c1` > any (select mpointfromtext(`c3`) from `t1`);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[10 Jul 2009 8:00] Sveta Smirnova
Bug is not repeatable for me with today mysql-azalea tree.
[27 Aug 2009 18:19] Philip Stoev
I still get it:

# 20:46:53 #6  0x000000315a42bec9 in __assert_fail () from /lib64/libc.so.6
# 20:46:53 #7  0x0000000000634bae in Field_string::val_str (this=0x20e79c0, val_buffer=0x20ff240, val_ptr=0x211a780) at field.cc:6418
# 20:46:53 #8  0x00000000005915ed in Item_field::val_str (this=0x211a770, str=0x20ff240) at item.cc:2055
# 20:46:53 #9  0x00000000005da84a in Arg_comparator::compare_string (this=0x20ff1a8) at item_cmpfunc.cc:1091
# 20:46:53 #10 0x00000000005e4b86 in Arg_comparator::compare (this=0x20ff1a8) at item_cmpfunc.h:74
# 20:46:53 #11 0x00000000005d8d53 in Item_func_eq::val_int (this=0x20ff0f8) at item_cmpfunc.cc:1710
# 20:46:53 #12 0x00000000005e34b4 in Item_equal::add (this=0x20280b0, c=0x211bce0) at item_cmpfunc.cc:5178
# 20:46:53 #13 0x00000000005e3536 in Item_equal::update_const (this=0x20280b0) at item_cmpfunc.cc:5315
# 20:46:53 #14 0x0000000000706926 in update_const_equal_items (cond=0x20280b0, tab=0x20fde10) at sql_select.cc:12047
# 20:46:53 #15 0x000000000070688a in update_const_equal_items (cond=0x2061fe0, tab=0x20fde10) at sql_select.cc:12040
# 20:46:53 #16 0x0000000000706df9 in join_read_const_table (tab=0x20fde10, pos=0x2377f10) at sql_select.cc:16743
# 20:46:53 #17 0x0000000000715925 in make_join_statistics (join=0x2375130, tables_arg=0x211abd8, conds=0x2061fe0, keyuse_array=0x237acc8) at sql_select.cc:4192
# 20:46:53 #18 0x0000000000719fdf in JOIN::optimize (this=0x2375130) at sql_select.cc:1609
# 20:46:53 #19 0x000000000071e98e in mysql_select (thd=0x1fbe528, rref_pointer_array=0x234a210, tables=0x234acd8, wild_num=0, fields=@0x7fd271d28db0, conds=0x2026870,
# 20:46:53     og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=1342177472, result=0x2026eb0, unit=0x2349998, select_lex=0x234a028)
# 20:46:53     at sql_select.cc:3077
# 20:46:53 #20 0x00000000007439e5 in mysql_multi_update (thd=0x1fbe528, table_list=0x234acd8, fields=0x234a130, values=0x234a540, conds=0x2026870, options=268435520,
# 20:46:53     handle_duplicates=DUP_ERROR, ignore=false, unit=0x2349998, select_lex=0x234a028) at sql_update.cc:1248
# 20:46:53 #21 0x0000000000681806 in mysql_execute_command (thd=0x1fbe528) at sql_parse.cc:3174
# 20:46:53 #22 0x0000000000737a5c in Prepared_statement::execute (this=0x1f41328, expanded_query=0x7fd271d2a2e0, open_cursor=false) at sql_prepare.cc:3765
# 20:46:53 #23 0x000000000073b971 in Prepared_statement::execute_loop (this=0x1f41328, expanded_query=0x7fd271d2a2e0, open_cursor=false, packet=0x0, packet_end=0x0)
# 20:46:53     at sql_prepare.cc:3397
# 20:46:53 #24 0x000000000073bbed in mysql_sql_stmt_execute (thd=0x1fbe528) at sql_prepare.cc:2570
# 20:46:53 #25 0x000000000067ed7f in mysql_execute_command (thd=0x1fbe528) at sql_parse.cc:2122
# 20:46:53 #26 0x000000000068757b in mysql_parse (thd=0x1fbe528, inBuf=0x2026710 "EXECUTE st1", length=11, found_semicolon=0x7fd271d2bf00) at sql_parse.cc:5950
# 20:46:53 #27 0x0000000000688196 in dispatch_command (command=COM_QUERY, thd=0x1fbe528, packet=0x1fa69a9 " EXECUTE st1 ", packet_length=13) at sql_parse.cc:1062
# 20:46:53 #28 0x0000000000689662 in do_command (thd=0x1fbe528) at sql_parse.cc:744
# 20:46:53 #29 0x000000000067689b in handle_one_connection (arg=0x1fbe528) at sql_connect.cc:1163
# 20:46:53 #30 0x000000315b0073da in start_thread () from /lib64/libpthread.so.0
# 20:46:53 #31 0x000000315a4e627d in clone () from /lib64/libc.so.6
[28 Aug 2009 3:29] MySQL Verification Team
not repeatable on 6.0.12.
[28 Aug 2009 3:31] MySQL Verification Team
philip your testcase is alot different to mine. i suspect the geometry functions in my testcase to have been a cause...
[10 Jan 2013 11:22] Erlend Dahl
Not reproducible on recent 5.5/5.6.