Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' in Field_long::val_int() with semijoin, merge views, derived_merge=ON, constant table

Bug #881449 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Critical
Igor Babaev

Bug Description

mysqld: field.cc:3635: virtual longlong Field_long::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.

#8 0x006b0d98 in __assert_fail () from /lib/libc.so.6
#9 0x08266044 in Field_long::val_int (this=0xae529848) at field.cc:3635
#10 0x081cf3cc in Item_field::val_int (this=0xae514660) at item.cc:2285
#11 0x081da010 in Item_direct_ref::val_int (this=0xae52dec8) at item.cc:6861
#12 0x0820d50e in Arg_comparator::compare_int_signed (this=0xae513ffc) at item_cmpfunc.cc:1159
#13 0x081f2986 in Arg_comparator::compare (this=0xae513ffc) at item_cmpfunc.h:72
#14 0x0820eee0 in Item_func_eq::val_int (this=0xae513f78) at item_cmpfunc.cc:1837
#15 0x0833ecd5 in join_read_const_table (tab=0xae52e9d4, pos=0xae531cf8) at sql_select.cc:15552
#16 0x08324204 in make_join_statistics (join=0xae52f400, tables_list=..., conds=0xae52e638, keyuse_array=0xae534540) at sql_select.cc:3361
#17 0x0831c930 in JOIN::optimize (this=0xae52f400) at sql_select.cc:1112
#18 0x08322709 in mysql_select (thd=0xaadf6e0, rref_pointer_array=0xaae125c, tables=0xae513090, wild_num=1, fields=..., conds=0xae514328, og_num=0,
    order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0xae514b68, unit=0xaae0e40, select_lex=0xaae1120)
    at sql_select.cc:2886
#19 0x0831a55f in handle_select (thd=0xaadf6e0, lex=0xaae0de4, result=0xae514b68, setup_tables_done_option=0) at sql_select.cc:283
#20 0x082b4d18 in execute_sqlcom_select (thd=0xaadf6e0, all_tables=0xae513090) at sql_parse.cc:5112
#21 0x082abad5 in mysql_execute_command (thd=0xaadf6e0) at sql_parse.cc:2250
#22 0x082b7347 in mysql_parse (thd=0xaadf6e0,
    rawbuf=0xae512ec0 "SELECT * FROM t1\nWHERE ( a ) IN (\nSELECT v3.b\nFROM t2\nRIGHT JOIN v3\nON ( v3.a = t2.a )\n)", length=89,
    found_semicolon=0xae8e1228) at sql_parse.cc:6112
#23 0x082a9724 in dispatch_command (command=COM_QUERY, thd=0xaadf6e0,
    packet=0xab38321 "SELECT * FROM t1\nWHERE ( a ) IN (\nSELECT v3.b\nFROM t2\nRIGHT JOIN v3\nON ( v3.a = t2.a )\n)", packet_length=89)
    at sql_parse.cc:1221
#24 0x082a8b7f in do_command (thd=0xaadf6e0) at sql_parse.cc:916
#25 0x082a5b63 in handle_one_connection (arg=0xaadf6e0) at sql_connect.cc:1191
#26 0x00821919 in start_thread () from /lib/libpthread.so.0
#27 0x0076acce in clone () from /lib/libc.so.6

explain also crashes.

minimal switch: semijoin=on,derived_merge=on
full switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=on,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on

bzr version-info
revision-id: <email address hidden>
date: 2011-10-24 12:54:28 -0700
build-date: 2011-10-25 17:33:06 +0300
revno: 3249
branch-nick: maria-5.3

test case:

CREATE TABLE t1 ( a varchar(1)) ;
INSERT INTO t1 VALUES ('a'),('b');

CREATE TABLE t2 ( a int, PRIMARY KEY (a)) ;
INSERT INTO t2 VALUES (1),(2);

CREATE TABLE t3 ( a int, b varchar(1)) ;
INSERT INTO t3 VALUES (1,'x');

CREATE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;

SET SESSION optimizer_switch='derived_merge=on,semijoin=on';

SELECT * FROM t1
WHERE ( a ) IN (
        SELECT v3.b
        FROM t2
        RIGHT JOIN v3
        ON ( v3.a = t2.a )
);

Changed in maria:
milestone: none → 5.3
assignee: nobody → Igor Babaev (igorb-seattle)
Changed in maria:
importance: Undecided → Critical
status: New → Confirmed
Changed in maria:
status: Confirmed → In Progress
Changed in maria:
status: In Progress → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.