Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
Description
Repeatable in mysql-5.1,5.5, maria 5.1, 5.2, 5.5. The following query:
SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
returns NULL even though there are obviously rows that match the WHERE predicate.
explain:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row
test case:
CREATE TABLE t1 (a int, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Re: Wrong result with aggregate + NOT BETWEEN + key
Assigning to Sanja, because he already dealt with some MIN/MAX
optimization bug recently.