Bug #28526 | Correlated subquery with GROUP BY on outer query returns no results in 5.0.40+ | ||
---|---|---|---|
Submitted: | 18 May 2007 17:15 | Modified: | 31 May 2007 5:52 |
Reporter: | Zak Kipling | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.0.40, 5.0.41, 5.0.42-20070517 | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
Tags: | bfsm_2007_05_31, regression |
[18 May 2007 17:15]
Zak Kipling
[20 May 2007 16:45]
MySQL Verification Team
verified exactly as described in initial report. >=5.0.40 returned 0 rows, < 5.0.40 returned 1 row. mysql> select version(); +--------------+ | version() | +--------------+ | 5.0.42-debug | +--------------+ <cut> mysql> SELECT location FROM subquery_bug_test AS a -> WHERE location=2 -> AND location=( SELECT location FROM subquery_bug_test AS b -> WHERE a.ref=b.ref -> AND b.location=2 -> LIMIT 1 ) -> GROUP BY location; Empty set (0.03 sec) ------------------ mysql> select version(); +--------------------------+ | version() | +--------------------------+ | 5.0.36-enterprise-gpl-nt | +--------------------------+ 1 row in set (0.00 sec) <cut> mysql> SELECT location FROM subquery_bug_test AS a -> WHERE location=2 -> AND location=( SELECT location FROM subquery_bug_test AS b -> WHERE a.ref=b.ref -> AND b.location=2 -> LIMIT 1 ) -> GROUP BY location; +----------+ | location | +----------+ | 2 | +----------+ 1 row in set (0.00 sec)
[31 May 2007 5:52]
Igor Babaev
This bug is a duplicate of bug #28337 which is already fixed: mysql> SELECT VERSION(); +--------------+ | VERSION() | +--------------+ | 5.0.44-debug | +--------------+ 1 row in set (0.00 sec) mysql> CREATE TABLE subquery_bug_test (ref BIGINT not null, location BIGINT not null); Query OK, 0 rows affected (0.49 sec) mysql> INSERT INTO subquery_bug_test (ref, location) VALUES (1,2); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO subquery_bug_test (ref, location) VALUES (3,2); Query OK, 1 row affected (0.00 sec) mysql> mysql> SELECT location FROM subquery_bug_test AS a -> WHERE location=2 -> AND location=( SELECT location FROM subquery_bug_test AS b -> WHERE a.ref=b.ref -> AND b.location=2 -> LIMIT 1 ) -> GROUP BY location; +----------+ | location | +----------+ | 2 | +----------+ 1 row in set (0.01 sec)