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

Wrong enum calculation result in where condition. #22717

Closed
wshwsh12 opened this issue Feb 4, 2021 · 3 comments · Fixed by #22785
Closed

Wrong enum calculation result in where condition. #22717

wshwsh12 opened this issue Feb 4, 2021 · 3 comments · Fixed by #22785
Assignees
Labels
severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@wshwsh12
Copy link
Contributor

wshwsh12 commented Feb 4, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table t;
create table t(e enum('a','','b'));
insert into t values(1),(2),(3);
select * from t where e;

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

MySQL [test]> select * from t where e;
+------+
| e    |
+------+
| a    |
|      |
| b    |
+------+
3 rows in set (0.000 sec)

3. What did you see instead (Required)

[tidb]> select * from t where e;
+------+
| e    |
+------+
| a    |
| b    |
+------+
2 rows in set (0.001 sec)

4. What is your TiDB version? (Required)

17a65ab

@wshwsh12 wshwsh12 added the type/bug The issue is confirmed as a bug. label Feb 4, 2021
@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Feb 4, 2021

https://github.com/pingcap/tidb/blob/master/expression/expression.go#L462 We should check Enum valuse, not Enum name.len. @ichn-hu PTAL

@ichn-hu
Copy link
Contributor

ichn-hu commented Feb 4, 2021

https://github.com/pingcap/tidb/blob/master/expression/expression.go#L462 We should check Enum valuse, not Enum name.len. @ichn-hu PTAL

Yeah... But I am currently on calling, I might only be available responding after the new year vacation

@ti-srebot
Copy link
Contributor

ti-srebot commented Feb 19, 2021

Please edit this comment or add a new 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) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

[v4.0.0:v4.0.10],[v5.0.0-rc]

6. Fixed versions

master

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.

6 participants