mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fixed bug mdev-4420.
The code of JOIN::optimize that performed substitutions for the best equal field in all ref items did not take into account that a multiple equality could contain the result of the single-value subquery if the subquery is inexpensive. This code was corrected. Also made necessary corresponding corrections in the code of make_join_select().
This commit is contained in:
@@ -1379,6 +1379,12 @@ JOIN::optimize()
|
||||
new store_key_const_item(*tab->ref.key_copy[key_copy_index],
|
||||
item);
|
||||
}
|
||||
else if (item->const_item())
|
||||
{
|
||||
tab->ref.key_copy[key_copy_index]=
|
||||
new store_key_item(*tab->ref.key_copy[key_copy_index],
|
||||
item, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
store_key_field *field_copy= ((store_key_field *)key_copy);
|
||||
@@ -8243,14 +8249,12 @@ static void add_not_null_conds(JOIN *join)
|
||||
Item *item= tab->ref.items[keypart];
|
||||
Item *notnull;
|
||||
Item *real= item->real_item();
|
||||
if (real->basic_const_item())
|
||||
if (real->const_item() && !real->is_expensive())
|
||||
{
|
||||
/*
|
||||
It could be constant instead of field after constant
|
||||
propagation.
|
||||
*/
|
||||
DBUG_ASSERT(real->is_expensive() || // prevent early expensive eval
|
||||
!real->is_null()); // NULLs are not propagated
|
||||
continue;
|
||||
}
|
||||
DBUG_ASSERT(real->type() == Item::FIELD_ITEM);
|
||||
|
||||
Reference in New Issue
Block a user