Merged the code of MWL#106 into 5.3

Resolved all conflicts, bad merges and fixed a few minor bugs in the code.
Commented out the queries from multi_update, view, subselect_sj, func_str,
derived_view, view_grant that failed either with crashes in ps-protocol or
with wrong results.
The failures are clear indications of some bugs in the code and these bugs
are to be fixed.
This commit is contained in:
Igor Babaev 2011-05-16 22:39:43 -07:00
commit 704f97035f
92 changed files with 4193 additions and 1095 deletions

View file

@ -202,7 +202,6 @@ Item_func::fix_fields(THD *thd, Item **ref)
with_sum_func= with_sum_func || item->with_sum_func;
with_field= with_field || item->with_field;
used_tables_cache|= item->used_tables();
not_null_tables_cache|= item->not_null_tables();
const_item_cache&= item->const_item();
with_subselect|= item->with_subselect;
}
@ -231,6 +230,21 @@ Item_func::quick_fix_field()
}
bool
Item_func::eval_not_null_tables(uchar *opt_arg)
{
Item **arg,**arg_end;
if (arg_count)
{
for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
{
not_null_tables_cache|= (*arg)->not_null_tables();
}
}
return FALSE;
}
void Item_func::fix_after_pullout(st_select_lex *new_parent, Item **ref)
{
Item **arg,**arg_end;
@ -3892,6 +3906,20 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref)
entry->collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT);
collation.set(entry->collation.collation, DERIVATION_IMPLICIT);
cached_result_type= args[0]->result_type();
{
/*
When this function is used in a derived table/view force the derived
table to be materialized to preserve possible side-effect of setting a
user variable.
*/
SELECT_LEX_UNIT *unit= thd->lex->current_select->master_unit();
TABLE_LIST *derived;
for (derived= unit->derived;
derived;
derived= derived->select_lex->master_unit()->derived)
derived->set_materialized_derived();
}
return FALSE;
}