The problem is that Item_field->context==NULL. I was not aware that this was possible when coding Item_field::fix_after_pullout()
If I track down how such Item_field was created, I can see that such field objects are created only when running INSERT ... SELECT:
#0 Item_field::Item_field (...) at item.cc:2050
#1 0x08347d42 in TABLE_LIST::change_refs_to_fields (...) at table.cc:6066
#2 0x0833b007 in unique_table (...) at sql_base.cc:1740
#3 0x08398598 in select_insert::prepare (...) at sql_insert.cc:3173
#4 0x08385d2b in JOIN::prepare (...) at sql_select.cc:834
#5 0x08386125 in mysql_select (...) at sql_select.cc:2930
select_insert::prepare is special, select_send::prepare and other select_result objects do not perform such actions.
The fix seems to be easy: we won't need to call fix_fields() for such items (they are created fixed), or do another name resolution, so we can just ignore the absent "context".
The problem is that Item_field- >context= =NULL. I was not aware that this was possible when coding Item_field: :fix_after_ pullout( )
If I track down how such Item_field was created, I can see that such field objects are created only when running INSERT ... SELECT:
#0 Item_field: :Item_field (...) at item.cc:2050 :change_ refs_to_ fields (...) at table.cc:6066 insert: :prepare (...) at sql_insert.cc:3173
#1 0x08347d42 in TABLE_LIST:
#2 0x0833b007 in unique_table (...) at sql_base.cc:1740
#3 0x08398598 in select_
#4 0x08385d2b in JOIN::prepare (...) at sql_select.cc:834
#5 0x08386125 in mysql_select (...) at sql_select.cc:2930
select_ insert: :prepare is special, select_ send::prepare and other select_result objects do not perform such actions.
The fix seems to be easy: we won't need to call fix_fields() for such items (they are created fixed), or do another name resolution, so we can just ignore the absent "context".