Code and comment wise I find nothing offensive. You might want to add
some tests to cover your code changes better and thus protect it from
regression. I leave it up to you to decide whether it's possible/worth
the effort, but I give one away for free. :-)
Georgi Kodinov wrote:
> [...]
>
> @@ -3304,9 +3325,7 @@ add_key_fields(JOIN *join, KEY_FIELD **k
> for (uint i= 1 ; i < cond_func->argument_count() ; i++)
> {
> Item_field *field_item;
> - if (cond_func->arguments()[i]->real_item()->type() ==
> Item::FIELD_ITEM
> - &&
> - !(cond_func->arguments()[i]->used_tables() &
> OUTER_REF_TABLE_BIT))
> + if (is_local_field (cond_func->arguments()[i]))
> {
> field_item= (Item_field *)
> (cond_func->arguments()[i]->real_item());
> add_key_equal_fields(key_fields, *and_level, cond_func,
>
To cover this, you can add something to the extent of
SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b BETWEEN t1.b
AND t1.b)
FROM t1
WHERE a = 230;
I wasn't able to find a simple ways to trigger the bug in the other
places, though. Perhaps it's not possible.
Regards
Martin