Sergey Glukhov skrev 2010-12-10 13.06:
> #At file:///home/gluh/MySQL/mysql-5.1-bugteam/ based on
> revid:bjorn.munch@stripped
>
> 3515 Sergey Glukhov 2010-12-10
> Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY
> clause
> Before sorting HAVING condition is splitted into two parts,
> first past is a table related condition and the rest of is
> HAVING part. Extraction of HAVING part does not take into account
> the fact that some of conditions might be non-const but
> have 'used_tables' == 0 (undependent subqueries)
> and because of that these conditions are cut off by
> make_cond_for_table() function.
> The fix is to use (table_map) 0 instead of used_tables in
> third argument for make_cond_for_table() function.
> It allows to extract elements which belong to sorted
> table and in addition elements which are undependend
> subqueries.
You might want to run a spell-checker on the comment. Misspelled change
set comments take longer to read.
I don't understand your fix. Ok, I understand that the IN condition is
non-constant but still doesn't refer to any tables. But why is there any
difference between sending a constant 0 and a variable which is 0?
Actually, I ran some test on my machine and I get used_tables == 1. Have
I missed something?
I ran the test with your fix and as you're saying, the condition
<in_optimizer>((3,2),<exists>(select 4,2 having (((<cache>(3) = 4) or
isnull(4)) and ((<cache>(2) = 2) or isnull(2)) and <is_not_null_test>(4)
and <is_not_null_test>(2)))) goes missing without your fix, but why?
Best Regards
Martin