3680 Sneha Modi 2011-12-22 [merge]
Bug#11754150: A test case for bug#6857 has been disabled in sp.test:
Merging from mysql-5.5 -> mysql-trunk
modified:
mysql-test/t/sp.test
3679 Jorgen Loland 2011-12-22
Bug#12773464 - 61925: WRONG RESULT WITH AGGREGATE +
NOT BETWEEN + KEY
The problem: opt_sum_query() was invoked to replace MAX(a) with
a constant in the query:
SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
However, opt_sum_query() mistook NOT BETWEEN for a BETWEEN
and therefore found the highest values lower than or equal to 9
and then tested the predicate on this value. The predicate
obviously evaluated to false and MAX(a) therefore evaluated to
NULL.
opt_sum_query() can only handle conjunctions ("AND" predicates)
but "x NOT BETWEEN a AND b" is equivalent to "x < a OR x > b"
and is therefore not a conjunction. The fix is to return
from the function without doing const replacement for
NOT BETWEENs.
@ mysql-test/r/func_group.result
Add test for Bug#12773464
@ mysql-test/t/func_group.test
Add test for Bug#12773464
@ sql/opt_sum.cc
opt_sum_query() can only handle conjunctions, so const
substitution cannot happen when there is a NOT BETWEEN predicate
modified:
mysql-test/r/func_group.result
mysql-test/t/func_group.test
sql/opt_sum.cc
=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test 2011-12-22 11:12:32 +0000
+++ b/mysql-test/t/sp.test 2011-12-22 17:43:39 +0000
@@ -3197,9 +3197,8 @@ create procedure bug6857()
begin
declare t0, t1 int;
declare plus bool default 0;
-
set t0 = unix_timestamp();
- select sleep(1.1);
+ select sleep(1.1);
set t1 = unix_timestamp();
if t1 > t0 then
set plus = 1;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (sneha.modi:3679 to 3680) Bug#6857Bug#11754150 | Sneha Modi | 25 Dec |