Details
Description
The bug was originally filed by a user at bugs.mysql.com. It's reproducible on MySQL 5.6 as well as MariaDB 5.3-10.0.
See the original description, including the test case, and the suggested patch in http://bugs.mysql.com/bug.php?id=68254 (I don't know if I may copy-paste it).
The major complaint is that if table t1 has rows
a b ---- 1 0 2 1 3 1 4 1
then, while a query
SELECT a from t1 group by b
returns
1 2
The query
SELECT x,y FROM t2 WHERE y IN (SELECT a FROM t1 GROUP BY b)
returns rows with y IN (1,2,3,4).
I've set it to Minor for now, because the query with GROUP BY is indeterministic according to MySQL documentation, so I don't see that much value in using it as a subquery; but it's still a bug since the subquery is supposed to return 2 values, not 4, even it can be any of (1,2), (1,3) or (1,4).
MySQL has verified the bug, although I don't know if they're going to fix it, and how.
Gliffy Diagrams
Attachments
Issue Links
- links to
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Strange, semijoin requirements have:
3. Subquery does not have GROUP BY or ORDER BY
in code:
!select_lex->group_list.elements && !join->order && // 3
but it still uses semijoin?