after merge changing

uninitialized value fixed
parent dd9cbce4
......@@ -385,7 +385,7 @@ bool Item_in_optimizer::fix_left(THD *thd,
cache->store(args[0]);
if (cache->cols() == 1)
{
if (args[0]->used_tables())
if ((used_tables_cache= args[0]->used_tables()))
cache->set_used_tables(OUTER_REF_TABLE_BIT);
else
cache->set_used_tables(0);
......@@ -400,7 +400,11 @@ bool Item_in_optimizer::fix_left(THD *thd,
else
((Item_cache *)cache->el(i))->set_used_tables(0);
}
used_tables_cache= args[0]->used_tables();
}
not_null_tables_cache= args[0]->not_null_tables();
with_sum_func= args[0]->with_sum_func;
const_item_cache= args[0]->const_item();
return 0;
}
......@@ -414,9 +418,6 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
if (args[0]->maybe_null)
maybe_null=1;
with_sum_func= args[0]->with_sum_func;
used_tables_cache= args[0]->used_tables();
const_item_cache= args[0]->const_item();
if (!args[1]->fixed && args[1]->fix_fields(thd, tables, args))
return 1;
Item_in_subselect * sub= (Item_in_subselect *)args[1];
......@@ -429,6 +430,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
maybe_null=1;
with_sum_func= with_sum_func || args[1]->with_sum_func;
used_tables_cache|= args[1]->used_tables();
not_null_tables_cache|= args[1]->not_null_tables();
const_item_cache&= args[1]->const_item();
return 0;
}
......
......@@ -148,7 +148,7 @@ void Item_subselect::fix_length_and_dec()
inline table_map Item_subselect::used_tables() const
{
return (table_map) (engine->dependent() ? 1L :
(engine->uncacheable() ? OUTER_REF_TABLE_BIT : 0L));
(engine->uncacheable() ? RAND_TABLE_BIT : 0L));
}
Item_singlerow_subselect::Item_singlerow_subselect(THD *thd,
......
......@@ -983,7 +983,7 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
{
table->used_fields= 0;
table->const_table= 0;
table->outer_join= table->null_row= 0;
table->null_row= 0;
table->status= STATUS_NO_RECORD;
table->keys_in_use_for_query= table->keys_in_use;
table->maybe_null= test(table->outer_join= table_list->outer_join);
......
......@@ -3614,7 +3614,7 @@ mysql_new_select(LEX *lex, bool move_down)
if (move_down)
{
/* first select_lex of subselect or derived table */
SELECT_LEX_UNIT *unit= new SELECT_LEX_UNIT();
SELECT_LEX_UNIT *unit= new(&lex->thd->mem_root) SELECT_LEX_UNIT();
if (!unit)
return 1;
unit->init_query();
......@@ -3638,7 +3638,7 @@ mysql_new_select(LEX *lex, bool move_down)
as far as we included SELECT_LEX for UNION unit should have
fake SELECT_LEX for UNION processing
*/
fake= unit->fake_select_lex= new SELECT_LEX();
fake= unit->fake_select_lex= new(&lex->thd->mem_root) SELECT_LEX();
fake->include_standalone(unit,
(SELECT_LEX_NODE**)&unit->fake_select_lex);
fake->select_number= INT_MAX;
......
......@@ -349,6 +349,11 @@ int st_select_lex_unit::exec()
mysql_select automatic allocation)
*/
fake_select_lex->join= new JOIN(thd, item_list, thd->options, result);
/*
Fake st_select_lex should have item list for correctref_array
allocation.
*/
fake_select_lex->item_list= item_list;
}
else
{
......
......@@ -965,7 +965,7 @@ create_select:
lex->sql_command= SQLCOM_INSERT_SELECT;
else if (lex->sql_command == SQLCOM_REPLACE)
lex->sql_command= SQLCOM_REPLACE_SELECT;
lex->current_select->select_lex()->table_list.save_and_clear(&lex->save_list);
lex->current_select->table_list.save_and_clear(&lex->save_list);
mysql_init_select(lex);
lex->current_select->parsing_place= SELECT_LEX_NODE::SELECT_LIST;
}
......@@ -974,7 +974,7 @@ create_select:
Select->parsing_place= SELECT_LEX_NODE::NO_MATTER;
}
opt_select_from
{ Lex->current_select->select_lex()->table_list.push_front(&Lex->save_list); }
{ Lex->current_select->table_list.push_front(&Lex->save_list); }
;
opt_as:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment