Wrong result with aggregate + NOT BETWEEN + key
Bug #813418 reported by
Philip Stoev
This bug affects 1 person
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| MariaDB |
Fix Released
|
High
|
Oleksandr "Sanja" Byelkin | ||
| MySQL Server |
Unknown
|
Unknown
|
|||
Bug 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)
SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
| Changed in maria: | |
| assignee: | nobody → Oleksandr "Sanja" Byelkin (sanja-byelkin) |
| importance: | Undecided → High |
| Changed in maria: | |
| status: | Confirmed → In Progress |
| Changed in maria: | |
| status: | In Progress → Fix Committed |
| Changed in maria: | |
| status: | Fix Committed → Fix Released |
To post a comment you must log in.

Assigning to Sanja, because he already dealt with some MIN/MAX
optimization bug recently.