-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
BIGINT out of range error code/message incorrect #9031
Comments
hi, @exialin
|
|
@exialin @jackysp What do you think about this issue? |
After discussed with @jackysp , we may fix Case 1 as I mentioned in this comment. |
This is now fixed in master. The warning messages differ between MySQL and TiDB: set sql_mode=DEFAULT;
drop table if exists t;
create table t(a bigint unsigned);
insert into t values (18446744073709551616);
insert into t value (18446744073709554616);
set sql_mode='';
insert into t value (-9223372036854775809);
SHOW WARNINGS;
insert into t value (-18446744073709551615);
SHOW WARNINGS;
SELECT * FROM t;
..
mysql> insert into t value (-9223372036854775809);
Query OK, 1 row affected, 1 warning (0.02 sec)
mysql> SHOW WARNINGS;
+---------+------+------------------------------------------------+
| Level | Code | Message |
+---------+------+------------------------------------------------+
| Warning | 1690 | constant -9223372036854775809 overflows bigint |
+---------+------+------------------------------------------------+
1 row in set (0.00 sec)
mysql> insert into t value (-18446744073709551615);
Query OK, 1 row affected, 1 warning (0.01 sec)
mysql> SHOW WARNINGS;
+---------+------+-------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------+
| Warning | 1690 | constant -18446744073709551615 overflows bigint |
+---------+------+-------------------------------------------------+
1 row in set (0.00 sec)
mysql>
mysql> SELECT * FROM t;
+------+
| a |
+------+
| 0 |
| 0 |
+------+
2 rows in set (0.00 sec) Vs MySQL: mysql [localhost:5731] {msandbox} (test) > insert into t value (-9223372036854775809);
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql [localhost:5731] {msandbox} (test) > SHOW WARNINGS;
+---------+------+--------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------+
| Warning | 1264 | Out of range value for column 'a' at row 1 |
+---------+------+--------------------------------------------+
1 row in set (0.00 sec)
mysql [localhost:5731] {msandbox} (test) > insert into t value (-18446744073709551615);
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql [localhost:5731] {msandbox} (test) > SHOW WARNINGS;
+---------+------+--------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------+
| Warning | 1264 | Out of range value for column 'a' at row 1 |
+---------+------+--------------------------------------------+
1 row in set (0.00 sec)
mysql [localhost:5731] {msandbox} (test) >
mysql [localhost:5731] {msandbox} (test) > SELECT * FROM t;
+------+
| a |
+------+
| 0 |
| 0 |
+------+
2 rows in set (0.00 sec)
|
Note: the errors actually match between TiDB and MySQL, but the warnings differ. Because the warnings only occur with a non-default sql-mode, I think this one is lower priority. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
Record two cases remain unresolved in PR #8544 . Here is some analysis #8544 (comment)
MySQL:
TiDB:
tidb-server -V
or runselect tidb_version();
on TiDB)?The text was updated successfully, but these errors were encountered: