Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5.27
-
None
Description
create table t1 (t1a int, t1b int, t1c int) engine=myisam; |
insert into t1 values (1,1,1),(2,2,2); |
|
create table t2 (t2a int, t2b int, t2c int) engine=myisam; |
insert into t2 values (1,1,1),(2,2,2),(3,3,3); |
MariaDB [test]> select * from t2 where t2a in ( select t1a from t1 group by (select t1a > t2b) order by t1a ); |
|
+------+------+------+ |
| t2a | t2b | t2c |
|
+------+------+------+ |
| 1 | 1 | 1 |
|
| 2 | 2 | 2 |
|
+------+------+------+ |
|
2 rows in set (0.051 sec) |
MariaDB [test]> select * from t2 where t2a in ( select t1a from t1 group by (select t1a > t2b where true) order by t1a ); |
+------+------+------+ |
| t2a | t2b | t2c |
|
+------+------+------+ |
| 1 | 1 | 1 |
|
+------+------+------+ |
1 row in set (0.019 sec) |
|
MariaDB [test]> prepare s from 'select * from t2 where t2a in ( select t1a from t1 group by (select t1a > t2b) order by t1a )'; |
|
Query OK, 0 rows affected (0.006 sec) |
Statement prepared
|
|
MariaDB [test]> execute s; |
+------+------+------+ |
| t2a | t2b | t2c |
|
+------+------+------+ |
| 1 | 1 | 1 |
|
+------+------+------+ |
|
Attachments
Issue Links
- relates to
-
MDEV-28621 group by optimization incorrectly removing subquery where subject buried in a function
-
- Closed
-
-
MDEV-34202 Followup to MDEV-28621: Perform GROUP BY removal safely
-
- Confirmed
-
This is caused by check_and_do_in_subquery_rewrites()/Item_singlerow_subselect::select_transformer()
If we disable this transformation, we have more consistency, but...
| t2a | t2b | t2c |
| 1 | 1 | 1 |
| t2a | t2b | t2c |
| 1 | 1 | 1 |
| t2a | t2b | t2c |
| 1 | 1 | 1 |
| 2 | 2 | 2 |
We clearly have another problem elsewhere.