Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| MariaDB |
Fix Released
|
Medium
|
Timour Katchaounov | ||
Bug Description
The following query:
SELECT * FROM t1 WHERE a IN ( SELECT a AS field1 FROM t1 GROUP BY field1 );
does not return rows that match the IN predicate (that is, all rows in the table). Same query without GROUP BY returns a correct result.
explain:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
2 DEPENDENT SUBQUERY t1 index NULL a 4 NULL 1 Using index
minimal optimizer switch: materialization
full optimizer switch: index_merge=
bzr version-info
revision-id: <email address hidden>
date: 2011-08-11 22:34:41 -0700
build-date: 2011-08-12 11:29:02 +0300
revno: 3151
branch-nick: maria-5.3
test case:
CREATE TABLE t1 (a date, KEY (a)) ;
INSERT INTO t1 VALUES ('2009-
SET SESSION optimizer_
SELECT * FROM t1 WHERE a IN ( SELECT a AS field1 FROM t1 GROUP BY field1 );
Reproducible in maria-5.3. Not reproducible in maria-5.2, mysql-5.5 . Not reproducible with integers. Does not involve NULLSs or constant optimizations.
| Changed in maria: | |
| milestone: | none → 5.3 |
| Changed in maria: | |
| assignee: | nobody → Timour Katchaounov (timour) |
| Changed in maria: | |
| status: | New → Confirmed |
| importance: | Undecided → Medium |
| Changed in maria: | |
| status: | Confirmed → In Progress |
| Changed in maria: | |
| status: | In Progress → Confirmed |
| Changed in maria: | |
| status: | Confirmed → In Progress |
| Changed in maria: | |
| status: | In Progress → Fix Committed |
| Changed in maria: | |
| status: | Fix Committed → Fix Released |
