-
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
SQL function BIN behaviour differ from MySQL. #13440
Labels
component/expression
severity/minor
sig/execution
SIG execution
type/bug
The issue is confirmed as a bug.
Comments
cireu
changed the title
SQL function BIN behaviour different from MySQL.
SQL function BIN behaviour differ from MySQL.
Nov 13, 2019
TiDB now has the same result as MySQL, except the warning message and error code differ: DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id INT NOT NULL PRIMARY KEY auto_increment,
`col_smallint` smallint(6) DEFAULT NULL
);
INSERT INTO t1 (col_smallint) VALUES (-32768);
SELECT format( '10:02:47.050292', ( 'p' DIV `col_smallint` ) ) AS field1 FROM t1 WHERE BIN( `col_smallint` );
SHOW WARNINGS;
..
mysql> SELECT format( '10:02:47.050292', ( 'p' DIV `col_smallint` ) ) AS field1 FROM t1 WHERE BIN( `col_smallint` );
+--------+
| field1 |
+--------+
| 10 |
+--------+
1 row in set, 2 warnings (0.00 sec)
mysql> SHOW WARNINGS;
+---------+------+----------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------+
| Warning | 8029 | Bad Number |
| Warning | 1292 | Truncated incorrect FLOAT value: '10:02:47.050292' |
+---------+------+----------------------------------------------------+
2 rows in set (0.00 sec)
mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-782-gb72e47e6d
Edition: Community
Git Commit Hash: b72e47e6db8863c08e47714391cf937b0f1c3269
Git Branch: master
UTC Build Time: 2020-07-15 01:26:06
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec) Vs MySQL: mysql [localhost:8021] {msandbox} (test) > SELECT format( '10:02:47.050292', ( 'p' DIV `col_smallint` ) ) AS field1 FROM t1 WHERE BIN( `col_smallint` );
+--------+
| field1 |
+--------+
| 10 |
+--------+
1 row in set, 2 warnings (0.00 sec)
mysql [localhost:8021] {msandbox} (test) > SHOW WARNINGS;
+---------+------+-----------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------+
| Warning | 1292 | Truncated incorrect DECIMAL value: 'p' |
| Warning | 1292 | Truncated incorrect DOUBLE value: '10:02:47.050292' |
+---------+------+-----------------------------------------------------+
2 rows in set (0.00 sec) |
Closed
degrade severity to minor for error code issue |
Shall we close it? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
component/expression
severity/minor
sig/execution
SIG execution
type/bug
The issue is confirmed as a bug.
Bug Report
Add by ting on 2020-11-19:
after the first round of fix, the original issue has been fixed. by now the diff between Tidb and MySQL for this scene is only the error code diff. detail info please see in last comments.
in tidb:
mysql> SHOW WARNINGS;
+---------+------+----------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------+
| Warning | 8029 | Bad Number |
| Warning | 1292 | Truncated incorrect FLOAT value: '10:02:47.050292' |
+---------+------+----------------------------------------------------+
2 rows in set (0.00 sec)
in MySQL:
mysql [localhost:8021] {msandbox} (test) > SHOW WARNINGS;
+---------+------+-----------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------+
| Warning | 1292 | Truncated incorrect DECIMAL value: 'p' |
| Warning | 1292 | Truncated incorrect DOUBLE value: '10:02:47.050292' |
+---------+------+-----------------------------------------------------+
Please answer these questions before submitting your issue. Thanks!
docker run --rm --name msql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=test -d mysql:8.0.15
git clone https://github.com/tikv/copr-test && cd copr-test
Output
MySQL output is correct, TiDB throw an error
ERROR 1690 (22003): BIGINT value is out of range in '1111111111111111111111111111111111111111111111111000000000000000'
tidb-server -V
or runselect tidb_version();
on TiDB)?v4.0.0-alpha-851-gaca3f4729
Related: tikv/copr-test#28
The text was updated successfully, but these errors were encountered: