mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-25174 DOUBLE columns do not accept large hex hybrids
Limit only signed integer fields fields to LONGLONG_MAX. Double and decimal fields do not need this limit, as they can store integers up to ULONGLONG_MAX without problems.
This commit is contained in:
parent
70dbd63e02
commit
09fe74c7fd
5 changed files with 50 additions and 1 deletions
|
@ -1283,5 +1283,18 @@ h varchar(16) YES NULL
|
|||
DROP TABLE t1, t2;
|
||||
SET sql_mode=DEFAULT;
|
||||
#
|
||||
# MDEV-25174 DOUBLE columns do not accept large hex hybrids
|
||||
#
|
||||
CREATE TABLE t1 (a DOUBLE);
|
||||
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
|
||||
INSERT INTO t1 VALUES (0x8000000000000000);
|
||||
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
9.223372036854776e18
|
||||
9.223372036854776e18
|
||||
1.8446744073709552e19
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
|
|
@ -798,6 +798,17 @@ DROP TABLE t1, t2;
|
|||
|
||||
SET sql_mode=DEFAULT;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-25174 DOUBLE columns do not accept large hex hybrids
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a DOUBLE);
|
||||
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
|
||||
INSERT INTO t1 VALUES (0x8000000000000000);
|
||||
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
|
|
@ -2873,5 +2873,18 @@ h varchar(16) YES NULL
|
|||
DROP TABLE t1, t2;
|
||||
SET sql_mode=DEFAULT;
|
||||
#
|
||||
# MDEV-25174 DOUBLE columns do not accept large hex hybrids
|
||||
#
|
||||
CREATE TABLE t1 (a DECIMAL(30,0));
|
||||
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
|
||||
INSERT INTO t1 VALUES (0x8000000000000000);
|
||||
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
9223372036854775807
|
||||
9223372036854775808
|
||||
18446744073709551615
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
|
|
@ -2050,6 +2050,17 @@ DROP TABLE t1, t2;
|
|||
|
||||
SET sql_mode=DEFAULT;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-25174 DOUBLE columns do not accept large hex hybrids
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(30,0));
|
||||
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
|
||||
INSERT INTO t1 VALUES (0x8000000000000000);
|
||||
INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
|
|
@ -1339,7 +1339,8 @@ int Field::store_hex_hybrid(const char *str, size_t length)
|
|||
goto warn;
|
||||
}
|
||||
nr= (ulonglong) longlong_from_hex_hybrid(str, length);
|
||||
if ((length == 8) && !(flags & UNSIGNED_FLAG) && (nr > LONGLONG_MAX))
|
||||
if ((length == 8) && cmp_type()== INT_RESULT &&
|
||||
!(flags & UNSIGNED_FLAG) && (nr > LONGLONG_MAX))
|
||||
{
|
||||
nr= LONGLONG_MAX;
|
||||
goto warn;
|
||||
|
|
Loading…
Reference in a new issue