You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
mysql> create table t(a int,b int,c int);
Query OK, 0 rows affected (0.11 sec)
mysql> insert into t values(1,2,3);
Query OK, 1 row affected (0.01 sec)
mysql> select a,max(b) as max_b from (select * from t union all select * from t) x ;
ERROR 1140 (42000): In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'x.a'; this is incompatible with sql_mode=only_full_group_by
mysql> select a,max(b) as max_b from (select * from t union all select 1,2,3 ) x ;
ERROR 1140 (42000): In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'x.a'; this is incompatible with sql_mode=only_full_group_by
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.3.0 |
+-----------+
1 row in set (0.01 sec)
tidb with new-only-full-group= on
tidb> select a,max(b) as max_b from (select * from t union all select * from t) x ;
ERROR 8123 (HY000): In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'x.a'; this is incompatible with sql_mode=only_full_group_by
tidb> select a,max(b) as max_b from (select * from t union all select 1,2,3 ) x ;
+------+-------+
| a | max_b |
+------+-------+
| 1 | 2 |
+------+-------+
1 row in set (0.01 sec)
2. What did you expect to see? (Required)
both two queries should both error
3. What did you see instead (Required)
the 2nd can run success?
4. What is your TiDB version? (Required)
master
The text was updated successfully, but these errors were encountered:
in the place marked with the red line, we found that since the union all have multiple children, while they share the same project column schema which is desirable, projecting column#8 as a constant is only right in the behavior of what the 2nd child does, not the 1st child. So for union-all case, maybe the functional dependency merge is not always right, we should discard fds of both child.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
both two queries should both error
3. What did you see instead (Required)
the 2nd can run success?
4. What is your TiDB version? (Required)
master
The text was updated successfully, but these errors were encountered: