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 results when comparing bit with string #11647

Closed
qw4990 opened this issue Aug 6, 2019 · 0 comments
Closed

wrong results when comparing bit with string #11647

qw4990 opened this issue Aug 6, 2019 · 0 comments
Assignees
Labels
component/expression type/bug The issue is confirmed as a bug.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Aug 6, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
create table xx (b bit(1));
insert into xx values (b'1');
select count(*) from xx where b='1';

The reason is that we select a wrong target field type in function RefineComparedConstant.

  1. What did you expect to see?
mysql> create table xx (b bit(1));
Query OK, 0 rows affected (0.05 sec)

mysql> insert into xx values (b'1');
Query OK, 1 row affected (0.00 sec)

mysql> select count(*) from xx where b='1';
+----------+
| count(*) |
+----------+
|        1 |
+----------+
1 row in set (0.00 sec)
  1. What did you see instead?
mysql> create table xx (b bit(1));
Query OK, 0 rows affected (0.01 sec)

mysql> insert into xx values (b'1');
Query OK, 1 row affected (0.00 sec)

mysql> select count(*) from xx where b='1';
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
mysql> select version();
+----------------------------------------+
| version()                              |
+----------------------------------------+
| 5.7.25-TiDB-v4.0.0-alpha-32-g45790b579 |
+----------------------------------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants