This commit is contained in:
Igor Babaev 2011-11-02 01:22:11 -07:00
commit c1ebb566b3
16 changed files with 177 additions and 41 deletions

View file

@ -1792,7 +1792,7 @@ Item *Item_in_optimizer::transform(Item_transformer transformer, uchar *argument
if (!new_item)
return 0;
if (args[1] != new_item)
current_thd->change_item_tree(args, new_item);
current_thd->change_item_tree(args + 1, new_item);
}
else
{

View file

@ -1698,7 +1698,7 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
The swap is needed for expressions of type 'f1 < ALL ( SELECT ....)'
where we want to evaluate the sub query even if f1 would be null.
*/
subs= func->create_swap(left_expr, subs);
subs= func->create_swap(*(optimizer->get_cache()), subs);
thd->change_item_tree(place, subs);
if (subs->fix_fields(thd, &subs))
DBUG_RETURN(true);

View file

@ -354,6 +354,12 @@ public:
Table record buffer used by this quick select.
*/
uchar *record;
virtual void replace_handler(handler *new_file)
{
DBUG_ASSERT(0); /* Only supported in QUICK_RANGE_SELECT */
}
#ifndef DBUG_OFF
/*
Print quick select information to DBUG_FILE. Caller is responsible
@ -449,6 +455,7 @@ public:
#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
virtual void replace_handler(handler *new_file) { file= new_file; }
private:
/* Default copy ctor used by QUICK_SELECT_DESC */
friend class TRP_ROR_INTERSECT;

View file

@ -588,10 +588,8 @@ void eliminate_tables(JOIN *join)
if (!join->outer_join)
DBUG_VOID_RETURN;
#ifndef DBUG_OFF
if (!optimizer_flag(thd, OPTIMIZER_SWITCH_TABLE_ELIMINATION))
DBUG_VOID_RETURN; /* purecov: inspected */
#endif
/* Find the tables that are referred to from WHERE/HAVING */
used_tables= (join->conds? join->conds->used_tables() : 0) |

View file

@ -9701,6 +9701,8 @@ bool JOIN_TAB::preread_init()
derived, DT_CREATE | DT_FILL))
return TRUE;
preread_init_done= TRUE;
if (select && select->quick)
select->quick->replace_handler(table->file);
return FALSE;
}