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

join return wrong result when using two equal condition #20180

Closed
ChenPeng2013 opened this issue Sep 23, 2020 · 3 comments · Fixed by #20258
Closed

join return wrong result when using two equal condition #20180

ChenPeng2013 opened this issue Sep 23, 2020 · 3 comments · Fixed by #20258
Assignees
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@ChenPeng2013
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use test;
drop table if exists t, t1;
create table t(a enum('a', 'b'), b tinyint);
create table t1(c varchar(20));
insert into t values('b', 0);
insert into t1 values('b');

select * from t, t1 where t.a= t1.c;
select * from t, t1 where t.b= t1.c;
select * from t, t1 where t.a = t1.c and t.b= t1.c;

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

mysql> select * from t, t1 where t.a= t1.c;
+------+------+------+
| a    | b    | c    |
+------+------+------+
| b    |    0 | b    |
+------+------+------+
1 row in set (0.00 sec)

mysql> select * from t, t1 where t.b= t1.c;
+------+------+------+
| a    | b    | c    |
+------+------+------+
| b    |    0 | b    |
+------+------+------+
1 row in set, 1 warning (0.00 sec)

mysql> select * from t, t1 where t.a = t1.c and t.b= t1.c;
+------+------+------+
| a    | b    | c    |
+------+------+------+
| b    |    0 | b    |
+------+------+------+
1 row in set, 1 warning (0.00 sec)

3. What did you see instead (Required)

mysql> select * from t, t1 where t.a= t1.c;
+------+------+------+
| a    | b    | c    |
+------+------+------+
| b    |    0 | b    |
+------+------+------+
1 row in set (0.00 sec)

mysql> select * from t, t1 where t.b= t1.c;
+------+------+------+
| a    | b    | c    |
+------+------+------+
| b    |    0 | b    |
+------+------+------+
1 row in set, 1 warning (0.01 sec)

mysql> select * from t, t1 where t.a = t1.c and t.b= t1.c;
Empty set, 1 warning (0.00 sec)

4. What is your TiDB version? (Required)

master 462927b and release-4.0 476c992

@ChenPeng2013 ChenPeng2013 added the type/bug The issue is confirmed as a bug. label Sep 23, 2020
@gengliqi gengliqi added the sig/execution SIG execution label Sep 24, 2020
@XuHuaiyu
Copy link
Contributor

PTAL @wshwsh12

@sre-bot
Copy link
Contributor

sre-bot commented Oct 9, 2020

Integrity check:
RCA symptom trigger_condition affect_version fix_version fields are empty
@wshwsh12
Please comment /info to get template

@ti-srebot
Copy link
Contributor

ti-srebot commented Oct 9, 2020

Please edit this comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA)

The Hybrid types use two EvelType in one expression and propagate a wrong condition.

2. Symptom

Wrong result.

3. All Trigger Conditions

The Hybrid types use two EvelType in one expression and propagate a wrong condition.

4. Workaround (optional)

Add cast function for the column.

5. Affected versions

[:v3.0.19],[:v4.0.7]

6. Fixed versions

[v3.0.20],[v4.0.8]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants