Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' fails in Field_string::val_str with derived_with_keys, MERGE view or FROM SQ
#24 0x0000000000726105 in handle_select (thd=0x3666898, lex=0x3668d88, result=0x3725070, setup_tables_done_option=0) at sql_select.cc:288
#25 0x00000000006b4dec in execute_sqlcom_select (thd=0x3666898, all_tables=0x36ea9a0) at sql_parse.cc:5172
#26 0x00000000006abf88 in mysql_execute_command (thd=0x3666898) at sql_parse.cc:2305
#27 0x00000000006b7753 in mysql_parse (thd=0x3666898, rawbuf=0x36ea670 "SELECT * FROM t1 AS outer_t1, v2 \nWHERE v2.a3 = outer_t1.a3 \nAND EXISTS ( SELECT * FROM t1 WHERE a2 < v2.a2 AND id = outer_t1.id )\nAND outer_t1.a3 < 'J' \nORDER BY v2.id", length=172, found_semicolon=0x7fc72c4bccb8) at sql_parse.cc:6173
#28 0x00000000006a9768 in dispatch_command (command=COM_QUERY, thd=0x3666898, packet=0x36e1319 "SELECT * FROM t1 AS outer_t1, v2 \nWHERE v2.a3 = outer_t1.a3 \nAND EXISTS ( SELECT * FROM t1 WHERE a2 < v2.a2 AND id = outer_t1.id )\nAND outer_t1.a3 < 'J' \nORDER BY v2.id", packet_length=172) at sql_parse.cc:1243
#29 0x00000000006a8a54 in do_command (thd=0x3666898) at sql_parse.cc:923
#30 0x00000000006a58dd in handle_one_connection (arg=0x3666898) at sql_connect.cc:1231
#31 0x00007fc735cabb50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#32 0x00007fc73504ea7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
Here is another test case, which also started failing from the same revision on 5.3, and causes a similar assertion, but does not require derived_with_keys (or any other specific optimizer_switch values):
CREATETABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERTINTO t1 VALUES (1,1);
CREATETABLE t2 ( pk INTPRIMARYKEY, c INT) ENGINE=MyISAM;
INSERTINTO t2 VALUES (1,4),(2,6);
SELECT ( SELECTMAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq, COUNT( DISTINCT from_sq.c )
FROM ( SELECTDISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq GROUPBY select_sq ;
#26 0x0000000000725f45 in handle_select (thd=0x26d8b88, lex=0x26db078, result=0x27923c8, setup_tables_done_option=0) at sql_select.cc:288
#27 0x00000000006b4c7c in execute_sqlcom_select (thd=0x26d8b88, all_tables=0x2791fb0) at sql_parse.cc:5172
#28 0x00000000006abe18 in mysql_execute_command (thd=0x26d8b88) at sql_parse.cc:2305
#29 0x00000000006b75e3 in mysql_parse (thd=0x26d8b88, rawbuf=0x275c8c0 "SELECT ( SELECT MAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq, COUNT( DISTINCT from_sq.c ) \nFROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq GROUP BY select_sq", length=200, found_semicolon=0x7ff6d0ca5cb8) at sql_parse.cc:6173
#30 0x00000000006a95f8 in dispatch_command (command=COM_QUERY, thd=0x26d8b88, packet=0x2753459 "SELECT ( SELECT MAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq, COUNT( DISTINCT from_sq.c ) \nFROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq GROUP BY select_sq"..., packet_length=201) at sql_parse.cc:1243
#31 0x00000000006a88e4 in do_command (thd=0x26d8b88) at sql_parse.cc:923
#32 0x00000000006a576d in handle_one_connection (arg=0x26d8b88) at sql_connect.cc:1231
#33 0x00007ff6da494b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#34 0x00007ff6d9837a7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
Elena Stepanova
added a comment - Here is another test case, which also started failing from the same revision on 5.3, and causes a similar assertion, but does not require derived_with_keys (or any other specific optimizer_switch values):
CREATE TABLE t1 (a INT , b INT ) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1);
CREATE TABLE t2 ( pk INT PRIMARY KEY , c INT ) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,4),(2,6);
SELECT ( SELECT MAX (b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq, COUNT ( DISTINCT from_sq.c )
FROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq GROUP BY select_sq ;
mysqld: field.cc:3664: virtual longlong Field_long::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
140131 18:59:50 [ERROR] mysqld got signal 6 ;
#6 0x00007ff6d9788621 in *__GI___assert_fail (assertion=0xcb8970 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=<optimized out>, line=3664, function=0xcbbca0 "virtual longlong Field_long::val_int()") at assert.c:81
#7 0x000000000065de99 in Field_long::val_int (this=0x27992d8) at field.cc:3664
#8 0x00000000005a5c15 in Item_field::val_int (this=0x2804dc8) at item.cc:2402
#9 0x00000000005b1f8f in Item_direct_ref::val_int (this=0x2799b60) at item.cc:6984
#10 0x00000000005b1f8f in Item_direct_ref::val_int (this=0x2793dc8) at item.cc:6984
#11 0x00000000005f05db in Arg_comparator::compare_int_signed (this=0x275e478) at item_cmpfunc.cc:1171
#12 0x00000000005d0638 in Arg_comparator::compare (this=0x275e478) at item_cmpfunc.h:72
#13 0x00000000005f2804 in Item_func_lt::val_int (this=0x275e3b8) at item_cmpfunc.cc:1915
#14 0x000000000074f5f3 in do_select (join=0x2793560, fields=0x27938f0, table=0x0, procedure=0x0) at sql_select.cc:15891
#15 0x000000000072ec15 in JOIN::exec (this=0x2793560) at sql_select.cc:2786
#16 0x000000000063bfa2 in subselect_single_select_engine::exec (this=0x275e798) at item_subselect.cc:3142
#17 0x000000000063482d in Item_subselect::exec (this=0x275e658) at item_subselect.cc:588
#18 0x0000000000636046 in Item_singlerow_subselect::val_int (this=0x275e658) at item_subselect.cc:1155
#19 0x00000000005bbc7b in Item::val_int_result (this=0x275e658) at item.h:872
#20 0x0000000000820ec9 in make_sortkey (param=0x7ff6d0ca40d0, to=0x281a258 "\220\263\201\002", ref_pos=0x27993a0 "8Ɓ\002") at filesort.cc:867
#21 0x0000000000820510 in find_all_keys (param=0x7ff6d0ca40d0, select=0x2802c00, sort_keys=0x281a1f8, sort_keys_buf=0x281a258 "\220\263\201\002", buffpek_pointers=0x7ff6d0ca42e0, tempfile=0x7ff6d0ca4150, indexfile=0x0) at filesort.cc:648
#22 0x000000000081f0c7 in filesort (thd=0x26d8b88, table=0x27981f0, sortorder=0x28055b8, s_length=1, select=0x2802c00, max_rows=18446744073709551615, sort_positions=false, examined_rows=0x7ff6d0ca4570) at filesort.cc:247
#23 0x000000000075840b in create_sort_index (thd=0x26d8b88, join=0x27923e8, order=0x2791e78, filesort_limit=18446744073709551615, select_limit=18446744073709551615, is_order_by=true) at sql_select.cc:19340
#24 0x000000000072e8e8 in JOIN::exec (this=0x27923e8) at sql_select.cc:2735
#25 0x000000000072f4af in mysql_select (thd=0x26d8b88, rref_pointer_array=0x26db878, tables=0x2791fb0, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x2791e78, having=0x0, proc_param=0x0, select_options=2147764736, result=0x27923c8, unit=0x26db118, select_lex=0x26db620) at sql_select.cc:3007
#26 0x0000000000725f45 in handle_select (thd=0x26d8b88, lex=0x26db078, result=0x27923c8, setup_tables_done_option=0) at sql_select.cc:288
#27 0x00000000006b4c7c in execute_sqlcom_select (thd=0x26d8b88, all_tables=0x2791fb0) at sql_parse.cc:5172
#28 0x00000000006abe18 in mysql_execute_command (thd=0x26d8b88) at sql_parse.cc:2305
#29 0x00000000006b75e3 in mysql_parse (thd=0x26d8b88, rawbuf=0x275c8c0 "SELECT ( SELECT MAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq, COUNT( DISTINCT from_sq.c ) \nFROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq GROUP BY select_sq", length=200, found_semicolon=0x7ff6d0ca5cb8) at sql_parse.cc:6173
#30 0x00000000006a95f8 in dispatch_command (command=COM_QUERY, thd=0x26d8b88, packet=0x2753459 "SELECT ( SELECT MAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq, COUNT( DISTINCT from_sq.c ) \nFROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq GROUP BY select_sq"..., packet_length=201) at sql_parse.cc:1243
#31 0x00000000006a88e4 in do_command (thd=0x26d8b88) at sql_parse.cc:923
#32 0x00000000006a576d in handle_one_connection (arg=0x26d8b88) at sql_connect.cc:1231
#33 0x00007ff6da494b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#34 0x00007ff6d9837a7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
Stack trace from:
revision-id: sanja@montyprogram.com-20140128212314-ha57mco1jb1lpsgp
revno: 3747
branch-nick: 5.3
Here is another test case, which also started failing from the same revision on 5.3, and causes a similar assertion, but does not require derived_with_keys (or any other specific optimizer_switch values):
mysqld: field.cc:3664: virtual longlong Field_long::val_int(): Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed.
140131 18:59:50 [ERROR] mysqld got signal 6 ;
#6 0x00007ff6d9788621 in *__GI___assert_fail (assertion=0xcb8970 "!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))", file=<optimized out>, line=3664, function=0xcbbca0 "virtual longlong Field_long::val_int()") at assert.c:81
#7 0x000000000065de99 in Field_long::val_int (this=0x27992d8) at field.cc:3664
#8 0x00000000005a5c15 in Item_field::val_int (this=0x2804dc8) at item.cc:2402
#9 0x00000000005b1f8f in Item_direct_ref::val_int (this=0x2799b60) at item.cc:6984
#10 0x00000000005b1f8f in Item_direct_ref::val_int (this=0x2793dc8) at item.cc:6984
#11 0x00000000005f05db in Arg_comparator::compare_int_signed (this=0x275e478) at item_cmpfunc.cc:1171
#12 0x00000000005d0638 in Arg_comparator::compare (this=0x275e478) at item_cmpfunc.h:72
#13 0x00000000005f2804 in Item_func_lt::val_int (this=0x275e3b8) at item_cmpfunc.cc:1915
#14 0x000000000074f5f3 in do_select (join=0x2793560, fields=0x27938f0, table=0x0, procedure=0x0) at sql_select.cc:15891
#15 0x000000000072ec15 in JOIN::exec (this=0x2793560) at sql_select.cc:2786
#16 0x000000000063bfa2 in subselect_single_select_engine::exec (this=0x275e798) at item_subselect.cc:3142
#17 0x000000000063482d in Item_subselect::exec (this=0x275e658) at item_subselect.cc:588
#18 0x0000000000636046 in Item_singlerow_subselect::val_int (this=0x275e658) at item_subselect.cc:1155
#19 0x00000000005bbc7b in Item::val_int_result (this=0x275e658) at item.h:872
#20 0x0000000000820ec9 in make_sortkey (param=0x7ff6d0ca40d0, to=0x281a258 "\220\263\201\002", ref_pos=0x27993a0 "8Ɓ\002") at filesort.cc:867
#21 0x0000000000820510 in find_all_keys (param=0x7ff6d0ca40d0, select=0x2802c00, sort_keys=0x281a1f8, sort_keys_buf=0x281a258 "\220\263\201\002", buffpek_pointers=0x7ff6d0ca42e0, tempfile=0x7ff6d0ca4150, indexfile=0x0) at filesort.cc:648
#22 0x000000000081f0c7 in filesort (thd=0x26d8b88, table=0x27981f0, sortorder=0x28055b8, s_length=1, select=0x2802c00, max_rows=18446744073709551615, sort_positions=false, examined_rows=0x7ff6d0ca4570) at filesort.cc:247
#23 0x000000000075840b in create_sort_index (thd=0x26d8b88, join=0x27923e8, order=0x2791e78, filesort_limit=18446744073709551615, select_limit=18446744073709551615, is_order_by=true) at sql_select.cc:19340
#24 0x000000000072e8e8 in JOIN::exec (this=0x27923e8) at sql_select.cc:2735
#25 0x000000000072f4af in mysql_select (thd=0x26d8b88, rref_pointer_array=0x26db878, tables=0x2791fb0, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x2791e78, having=0x0, proc_param=0x0, select_options=2147764736, result=0x27923c8, unit=0x26db118, select_lex=0x26db620) at sql_select.cc:3007
#26 0x0000000000725f45 in handle_select (thd=0x26d8b88, lex=0x26db078, result=0x27923c8, setup_tables_done_option=0) at sql_select.cc:288
#27 0x00000000006b4c7c in execute_sqlcom_select (thd=0x26d8b88, all_tables=0x2791fb0) at sql_parse.cc:5172
#28 0x00000000006abe18 in mysql_execute_command (thd=0x26d8b88) at sql_parse.cc:2305
#29 0x00000000006b75e3 in mysql_parse (thd=0x26d8b88, rawbuf=0x275c8c0 "SELECT ( SELECT MAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq, COUNT( DISTINCT from_sq.c ) \nFROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq GROUP BY select_sq", length=200, found_semicolon=0x7ff6d0ca5cb8) at sql_parse.cc:6173
#30 0x00000000006a95f8 in dispatch_command (command=COM_QUERY, thd=0x26d8b88, packet=0x2753459 "SELECT ( SELECT MAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq, COUNT( DISTINCT from_sq.c ) \nFROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq GROUP BY select_sq"..., packet_length=201) at sql_parse.cc:1243
#31 0x00000000006a88e4 in do_command (thd=0x26d8b88) at sql_parse.cc:923
#32 0x00000000006a576d in handle_one_connection (arg=0x26d8b88) at sql_connect.cc:1231
#33 0x00007ff6da494b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#34 0x00007ff6d9837a7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
Stack trace from:
revision-id: sanja@montyprogram.com-20140128212314-ha57mco1jb1lpsgp
revno: 3747
branch-nick: 5.3