Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coercibility is wrong for subquery #30748

Closed
wjhuang2016 opened this issue Dec 15, 2021 · 2 comments · Fixed by #30750
Closed

coercibility is wrong for subquery #30748

wjhuang2016 opened this issue Dec 15, 2021 · 2 comments · Fixed by #30750
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

wjhuang2016 commented Dec 15, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `t` (
  `a` char(10) DEFAULT NULL
);
CREATE TABLE `t1` (
  `a` char(10) COLLATE utf8mb4_general_ci DEFAULT NULL
);
insert into t values ("a");
insert into t1 values ("A");
select * from t where t.a  = all (select a collate utf8mb4_general_ci  from t1);
select * from t where t.a  != any (select a collate utf8mb4_general_ci  from t1);
select a as a_col from t where t.a <= all (select a collate utf8mb4_general_ci from t1);
select a as a_col from t where t.a <= any (select a collate utf8mb4_general_ci from t1);
select * from t where t.a  = (select a collate utf8mb4_general_ci  from t1);

2. What did you expect to see? (Required)

mysql> select * from t where t.a  = all (select a collate utf8mb4_general_ci  from t1);
+------+
| a    |
+------+
| a    |
+------+
1 row in set (0.00 sec)

mysql> select * from t where t.a  != any (select a collate utf8mb4_general_ci  from t1);
Empty set (0.00 sec)

mysql> select a as a_col from t where t.a <= all (select a collate utf8mb4_general_ci from t1);
+------+
| a    |
+------+
| a    |
+------+
1 row in set (0.00 sec)

mysql> select a as a_col from t where t.a <= any (select a collate utf8mb4_general_ci from t1);
+------+
| a    |
+------+
| a    |
+------+
1 row in set (0.00 sec)

mysql> select * from t where t.a  = (select a collate utf8mb4_general_ci  from t1);
+------+
| a    |
+------+
| a    |
+------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select * from t where t.a  = all (select a collate utf8mb4_general_ci  from t1);
Empty set (0.00 sec)

mysql> select * from t where t.a  != any (select a collate utf8mb4_general_ci  from t1);
+------+
| a    |
+------+
| a    |
+------+
1 row in set (0.00 sec)

mysql> select a as a_col from t where t.a <= all (select a collate utf8mb4_general_ci from t1);
Empty set (0.00 sec)

mysql> select a as a_col from t where t.a <= any (select a collate utf8mb4_general_ci from t1);
Empty set (0.01 sec)

mysql> select * from t where t.a  = (select a collate utf8mb4_general_ci  from t1);
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

master

@wjhuang2016 wjhuang2016 added type/bug The issue is confirmed as a bug. severity/major affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. sig/planner SIG: Planner labels Dec 15, 2021
@yudongusa
Copy link

Assign this to @wjhuang2016 who is working on #30750

@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants