Skip to content

the ranges of Numeric data types failed #279

Closed

Description

@MOOS2021
  1. tinyint, samllint, int and bigint don't support negative numbers now.

  2. in both signed and unsigned tables, the ranges of them are not supported well as following.

mysql> create table numtable(a tinyint, b smallint, c int , d bigint);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into numtable values(128,32767,2147483647,9223372036854775807);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into numtable values(127,32768,2147483647,9223372036854775807);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into numtable values(127,32767,2147483648,9223372036854775807);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into numtable values(127,32767,2147483647,9223372036854775808);
Query OK, 0 rows affected (0.00 sec)

mysql> select * from numtable;
+--------+-------------+----------------------+------+
| b | c | d | a |
+--------+-------------+----------------------+------+
| 32767 | 2147483647 | -9223372036854775808 | 127 |
| 32767 | -2147483648 | 9223372036854775807 | 127 |
| -32768 | 2147483647 | 9223372036854775807 | 127 |
| 32767 | 2147483647 | 9223372036854775807 | -128 |
+--------+-------------+----------------------+------+
4 rows in set (0.00 sec)

mysql> drop table numtable;
Query OK, 0 rows affected (0.00 sec)

mysql> create table numtable(a tinyint unsigned, b smallint unsigned, c int unsigned, d bigint unsigned);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into numtable values(255,65535,4294967295,18446744073709551615);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into numtable values(256,65535,4294967295,18446744073709551615);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into numtable values(255,65536,4294967295,18446744073709551615);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into numtable values(255,65536,4294967296,18446744073709551615);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into numtable values(255,65536,4294967296,18446744073709551616);
ERROR 1105 (HY000): unkown error:[42P18]unsupport value: 1.84467e+19
mysql> select * from numtable;
+------------+------+------+-------+
| c | d | a | b |
+------------+------+------+-------+
| 0 | -1 | 255 | 0 |
| 4294967295 | -1 | 0 | 65535 |
| 4294967295 | -1 | 255 | 65535 |
| 4294967295 | -1 | 255 | 0 |
+------------+------+------+-------+
4 rows in set (0.01 sec)

Activity

  1. added
    kind/bug
    on Aug 4, 2021
  2. added
    kind/compatibility
    and removed
    kind/bug
    on Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind/compatibility

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions