Comment 1 for bug 836532

Revision history for this message
Sergey Petrunia (sergefp) wrote :

The crash is here:

(gdb) wher
  #0 0x0822cd38 in Item_equal_fields_iterator::get_curr_field (this=0x90434bcc) at item_cmpfunc.h:1790
  #1 0x0821d9cc in Item_equal::contains (this=0xb1fbb00, field=0xb1f2338) at item_cmpfunc.cc:5438
  #2 0x0835e4ad in find_item_equal (cond_equal=0xb1f945c, field=0xb1f2338, inherited_fl=0x90434cea) at sql_select.cc:10313
  #3 0x08424d6d in setup_sj_materialization_part2 (sjm_tab=0xb1fb084) at opt_subselect.cc:3150
  #4 0x083616f3 in make_join_readinfo (join=0xb201db8, options=4, no_jbuf_after=3) at sql_select.cc:9306
  #5 0x08371c61 in JOIN::optimize (this=0xb201db8) at sql_select.cc:1497
  #6 0x081b96cb in st_select_lex::optimize_unflattened_subqueries (this=0xb184938) at sql_lex.cc:3126
  #7 0x08421fdb in JOIN::optimize_unflattened_subqueries (this=0xb1fbe40) at opt_subselect.cc:4324
  #8 0x08371cf2 in JOIN::optimize (this=0xb1fbe40) at sql_select.cc:1504
  #9 0x08373a40 in mysql_select (...) at sql_select.cc:2887

(gdb) up
  #1 0x0821d9cc in Item_equal::contains (this=0xb1fbb00, field=0xb1f2338) at item_cmpfunc.cc:5438
(gdb) p this
  $306 = (Item_func_eq *) 0xb1fbb00
         ^^^^^^^^^^^^^^^^^ How come this is an Item_func_eq, while we are
         in Item_equal's function?
         Item_equal and Item_func_eq do not inherit from one another, something
         is clearly wrong.

(gdb) up
  #1 0x0821d9cc in Item_equal::contains (this=0xb1fbb00, field=0xb1f2338) at item_cmpfunc.cc:5438
(gdb) p this
  $306 = (Item_func_eq *) 0xb1fbb00
(gdb) up
  #2 0x0835e4ad in find_item_equal (cond_equal=0xb1f945c, field=0xb1f2338, inherited_fl=0x90434cea) at sql_select.cc:10313
(gdb) p cond_equal->current_level.head()
  $307 = (Item_func_eq *) 0xb1fbb00

(gdb) p &cond_equal->current_level
  $309 = (List<Item_equal> *) 0xb1f9464

(gdb) p cond_equal->current_level.head()
  $307 = (Item_func_eq *) 0xb1fbb00

^^^ So we went up and see that cond_equal->current_level, which is of type
List<Item_equal> somehow ended up containing an Item_func_eq.