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

different types compare error #20128

Closed
ChenPeng2013 opened this issue Sep 21, 2020 · 11 comments · Fixed by #21338
Closed

different types compare error #20128

ChenPeng2013 opened this issue Sep 21, 2020 · 11 comments · Fixed by #21338
Assignees
Labels
challenge-program duplicate Issues or pull requests already exists. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@ChenPeng2013
Copy link
Contributor

ChenPeng2013 commented Sep 21, 2020

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

# case 1
use test;
drop table if exists t;
create table t(b enum('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') DEFAULT NULL, c decimal(40,20));
insert into t values('z', 19.18040000000000000000);
select * from t where t.b > t.c;

# case 2
drop table if exists t;
create table t(a bit(64), b double);
insert into t values(-21172, -11623);
select * from t where a < b;

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

# case 1
mysql> create table t(b enum('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') DEFAULT NULL, c decimal(40,20));
Query OK, 0 rows affected (0.08 sec)

mysql> insert into t values('z', 19.18040000000000000000);
Query OK, 1 row affected (0.01 sec)

mysql> select * from t where t.b > t.c;
+------+-------------------------+
| b    | c                       |
+------+-------------------------+
| z    | 19.18040000000000000000 |
+------+-------------------------+
1 row in set (0.00 sec)

# case 2
mysql> drop table if exists t;
Query OK, 0 rows affected (0.01 sec)

mysql> create table t(a bit(64), b double);
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t values(-21172, -11623);
Query OK, 1 row affected (0.00 sec)

mysql> select * from t where a < b;
+----------+--------+
| a        | b      |
+----------+--------+
| �������L        | -11623 |
+----------+--------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

# case 1
mysql> create table t(b enum('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') DEFAULT NULL, c decimal(40,20));
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t values('z', 19.18040000000000000000);
Query OK, 1 row affected (0.00 sec)

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

# case 2
mysql> drop table if exists t;
Query OK, 0 rows affected (0.19 sec)

mysql> create table t(a bit(64), b double);
Query OK, 0 rows affected (0.07 sec)

mysql> insert into t values(-21172, -11623);
Query OK, 1 row affected (0.01 sec)

mysql> select * from t where a < b;
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

master f6d445c and release-4.0 0fbe796

SIG slack channel

#sig-exec

Score

  • 900

Mentor

@ChenPeng2013 ChenPeng2013 added the type/bug The issue is confirmed as a bug. label Sep 21, 2020
@gengliqi gengliqi added the sig/execution SIG execution label Sep 22, 2020
@lzmhhh123 lzmhhh123 added challenge-program help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Oct 30, 2020
@lzmhhh123
Copy link
Contributor

lzmhhh123 commented Nov 12, 2020

Duplicate of #17994

@lzmhhh123 lzmhhh123 marked this as a duplicate of #17994 Nov 12, 2020
@lzmhhh123 lzmhhh123 added the duplicate Issues or pull requests already exists. label Nov 12, 2020
@newcworld
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@pengdaqian2020 You did not submit PR within 7 days, so give up automatically.

@ti-challenge-bot ti-challenge-bot bot removed the picked label Nov 20, 2020
@zhaoxugang
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@ti-challenge-bot
Copy link

@zhaoxugang You did not submit PR within 7 days, so give up automatically.

@zhaoxugang
Copy link
Contributor

/pick-up

@ti-challenge-bot
Copy link

Pick up success.

@wshwsh12
Copy link
Contributor

I have a try case 2 in mysql8.0.22, the result is same with tidb. Should we keep the behavior same with the new version Mysql? @ChenPeng2013

MySQL [test]> select version();
+-----------+
| version() |
+-----------+
| 8.0.22    |
+-----------+
1 row in set (0.000 sec)

MySQL [test]> drop table if exists t;
Query OK, 0 rows affected (0.006 sec)

MySQL [test]> create table t(a bit(64), b double);
Query OK, 0 rows affected (0.008 sec)

MySQL [test]> insert into t values(-21172, -11623);
Query OK, 1 row affected (0.001 sec)

MySQL [test]> select * from t where a < b;
Empty set (0.000 sec)

@ti-challenge-bot
Copy link

@zhaoxugang You did not submit PR within 7 days, so give up automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge-program duplicate Issues or pull requests already exists. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
7 participants