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

float type incompatible behavior from mysql #26447

Open
aytrack opened this issue Jul 21, 2021 · 0 comments
Open

float type incompatible behavior from mysql #26447

aytrack opened this issue Jul 21, 2021 · 0 comments
Labels
severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@aytrack
Copy link
Contributor

aytrack commented Jul 21, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t2(a float, b float, c float as (a % 10), key (c));
insert into t2 (a) values (-100), (20);
select c from t2 union select c from t2;
select c from t2;
select * from t2;

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

mysql>  select c from t2 union select c from t2;
+------+
| c    |
+------+
|   -0 |
|    0 |
+------+
2 rows in set (0.03 sec)

mysql> select c from t2;
+------+
| c    |
+------+
|   -0 |
|    0 |
+------+
2 rows in set (0.04 sec)

mysql> select * from t2;
+------+------+------+
| a    | b    | c    |
+------+------+------+
| -100 | NULL |   -0 |
|   20 | NULL |    0 |
+------+------+------+
2 rows in set (0.04 sec)

3. What did you see instead (Required)

mysql> create table t2(a float, b float, c float as (a % 10), key (c));
Query OK, 0 rows affected (0.18 sec)

mysql> insert into t2 (a) values (-100), (20);
Query OK, 2 rows affected (0.09 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> select c from t2 union select c from t2;
+---+
| c |
+---+
| 0 |
+---+
1 row in set (0.07 sec)

mysql>
mysql> select c from t2;
+------+
| c    |
+------+
|    0 |
|    0 |
+------+
2 rows in set (0.04 sec)

mysql> select * from t2;
+------+------+------+
| a    | b    | c    |
+------+------+------+
| -100 | NULL |   -0 |
|   20 | NULL |    0 |
+------+------+------+
2 rows in set (0.03 sec)

4. What is your TiDB version? (Required)

5.0.3
4.0.14

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

No branches or pull requests

1 participant