Skip to content

bug: the range of unsigned should be determined #1151

@davidshiz

Description

@davidshiz

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

the range of unsigned ( INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT ) should be determined,
and when INSERT the unsigned data out of range, should return the correct prompt message.

mysql> create table test(
id1 TINYINT UNSIGNED,
id2 SMALLINT UNSIGNED,
id3 INT UNSIGNED,
id4 BIGINT UNSIGNED
);
Query OK, 0 rows affected (0.02 sec)

mysql> insert into test values(255,65535,4294967295,18446744073709551615);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test values(253,65533,4294967293,18446744073709551613);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;
+------+-------+------------+----------------------+
| id1  | id2   | id3        | id4                  |
+------+-------+------------+----------------------+
|  127 | 32767 | 2147483647 | 18446744073709551615 |
|  127 | 32767 | 2147483647 | 18446744073709551613 |
+------+-------+------------+----------------------+
2 rows in set (0.00 sec)

Expected behavior

mysql> create table test(
id1 TINYINT UNSIGNED,
id2 SMALLINT UNSIGNED,
id3 INT UNSIGNED,
id4 BIGINT UNSIGNED
);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into test values(255,65535,4294967295,18446744073709551615);
Query OK, 1 row affected (0.00 sec)

mysql> insert into test values(253,65533,4294967293,18446744073709551613);
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;
+------+-------+------------+----------------------+
| id1  | id2   | id3        | id4                  |
+------+-------+------------+----------------------+
|  255 | 65535 | 4294967295 | 18446744073709551615 |
|  253 | 65533 | 4294967293 | 18446744073709551613 |
+------+-------+------------+----------------------+
2 rows in set (0.00 sec)

How To Reproduce

create table test(id1 TINYINT UNSIGNED,id2 SMALLINT UNSIGNED,id3 INT UNSIGNED,id4 BIGINT UNSIGNED);
insert into test values(255,65535,4294967295,18446744073709551615);
insert into test values(253,65533,4294967293,18446744073709551613);
select * from test;

Environment

root@ub01:~# /stonedb57/install/bin/mysqld --version
/stonedb57/install/bin/mysqld  Ver 5.7.36-StoneDB for Linux on x86_64 (build-)
build information as follow:
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: 863cebc58
        Last commit time: Date:   Wed Dec 7 14:16:34 2022 +0800
        Build time: Date: Mon Dec 19 14:29:02 CST 2022
root@ub01:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!

Metadata

Metadata

Assignees

Labels

A-bugSomething isn't workingC-stonedb-5.7associated with stonedb 5.7prio: highHigh priority

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions