-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
the behavior of bit type for / is incompatible with MySQL #23479
Labels
Comments
aytrack
added
type/bug
The issue is confirmed as a bug.
sig/execution
SIG execution
labels
Mar 23, 2021
following sqls are execute on tidb. mysql > select b'10000000' / 10;
+------------------+
| b'10000000' / 10 |
+------------------+
| 0.9000 |
+------------------+
1 row in set
Time: 0.061s
mysql> show warnings;
+---------+------+-------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------+
| Warning | 1690 | DECIMAL value is out of range in '(1, 0)' |
+---------+------+-------------------------------------------+
1 row in set
Time: 0.052s
mysql > create table t1(a bit(8), b int);
Query OK, 0 rows affected
Time: 0.181s
mysql > create table t2(a bit(8) primary key, b int);
Query OK, 0 rows affected
Time: 0.178s
mysql > insert into t1 values (b'10000000', 10);
Query OK, 1 row affected
Time: 0.080s
mysql > insert into t2 values (b'10000000', 10);
Query OK, 1 row affected
Time: 0.274s
mysql > select a/b from t1;
+------+
| a/b |
+------+
| 12.8 |
+------+
1 row in set
Time: 0.072s
mysql > select a/b from t2;
+------+
| a/b |
+------+
| 12.8 |
+------+
1 row in set
Time: 0.065s
mysql > create table t3(a bit(8), b decimal(10, 3) as (a / 10));
Query OK, 0 rows affected
Time: 0.303s
mysql > insert into t3(a) values (b'10000000');
Query OK, 1 row affected
Time: 0.073s
mysql> select * from t3;
+------+--------+
| a | b |
+------+--------+
| 0x80 | 12.800 |
+------+--------+
|
aytrack
changed the title
the behavior of bit/int is incompatible with MySQL
the behavior of bit type for / is incompatible with MySQL
Mar 23, 2021
Closed
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
This was referenced Apr 25, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master: fd706ab
release-5.0: 03f11d2
The text was updated successfully, but these errors were encountered: