mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Addition to the fix to LP bug#994275.
It is problem of constant propagated to ref* access method (the problem was hiden by using debug binaries for testing).
This commit is contained in:
@ -1288,11 +1288,22 @@ JOIN::optimize()
|
||||
Item *item= ref_item->real_item();
|
||||
store_key *key_copy= tab->ref.key_copy[key_copy_index];
|
||||
if (key_copy->type() == store_key::FIELD_STORE_KEY)
|
||||
{
|
||||
if (item->basic_const_item())
|
||||
{
|
||||
/* It is constant propagated here */
|
||||
tab->ref.key_copy[key_copy_index]=
|
||||
new store_key_const_item(*tab->ref.key_copy[key_copy_index],
|
||||
item);
|
||||
}
|
||||
else
|
||||
{
|
||||
store_key_field *field_copy= ((store_key_field *)key_copy);
|
||||
DBUG_ASSERT(item->type() == Item::FIELD_ITEM);
|
||||
field_copy->change_source_field((Item_field *) item);
|
||||
}
|
||||
}
|
||||
}
|
||||
key_copy_index++;
|
||||
}
|
||||
}
|
||||
|
@ -1468,6 +1468,11 @@ public:
|
||||
to_field=field_arg->new_key_field(thd->mem_root, field_arg->table,
|
||||
ptr, null, 1);
|
||||
}
|
||||
store_key(store_key &arg)
|
||||
:null_key(arg.null_key), to_field(arg.to_field),
|
||||
null_ptr(arg.null_ptr), err(arg.err)
|
||||
|
||||
{}
|
||||
virtual ~store_key() {} /** Not actually needed */
|
||||
virtual enum Type type() const=0;
|
||||
virtual const char *name() const=0;
|
||||
@ -1572,6 +1577,10 @@ public:
|
||||
null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ?
|
||||
&err : (uchar*) 0, length), item(item_arg), use_value(val)
|
||||
{}
|
||||
store_key_item(store_key &arg, Item *new_item, bool val)
|
||||
:store_key(arg), item(new_item), use_value(val)
|
||||
{}
|
||||
|
||||
|
||||
enum Type type() const { return ITEM_STORE_KEY; }
|
||||
const char *name() const { return "func"; }
|
||||
@ -1622,6 +1631,9 @@ public:
|
||||
&err : (uchar*) 0, length, item_arg, FALSE), inited(0)
|
||||
{
|
||||
}
|
||||
store_key_const_item(store_key &arg, Item *new_item)
|
||||
:store_key_item(arg, new_item, FALSE), inited(0)
|
||||
{}
|
||||
|
||||
enum Type type() const { return CONST_ITEM_STORE_KEY; }
|
||||
const char *name() const { return "const"; }
|
||||
|
Reference in New Issue
Block a user