mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-36015: unrepresentable value in row_parse_int()
row_parse_int(): Refactor the code and define the function static in one compilation unit. For any negative values, we must return 0. row_search_get_max_rec(), row_search_max_autoinc(): Moved to the same compilation unit with row_parse_int(). We also remove a work-around of an internal compiler error when targeting ARMv8 on GCC 4.8.5, a compiler that is no longer supported. Reviewed by: Debarun Banerjee
This commit is contained in:
committed by
Sergei Golubchik
parent
44e1f7238a
commit
c07e355c40
@@ -190,8 +190,7 @@ a
|
||||
100000000000
|
||||
100000000006
|
||||
CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB;
|
||||
INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0),
|
||||
(20), (30), (31);
|
||||
INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
|
||||
SELECT * FROM t11;
|
||||
a
|
||||
-10
|
||||
@@ -204,9 +203,22 @@ a
|
||||
20
|
||||
30
|
||||
31
|
||||
CREATE TABLE t11u(a FLOAT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
|
||||
INSERT INTO t11u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
|
||||
ERROR 22003: Out of range value for column 'a' at row 5
|
||||
INSERT INTO t11u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
|
||||
SELECT * FROM t11u;
|
||||
a
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
20
|
||||
30
|
||||
31
|
||||
CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB;
|
||||
INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0),
|
||||
(20), (30), (31);
|
||||
INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
|
||||
SELECT * FROM t12;
|
||||
a
|
||||
-10
|
||||
@@ -219,6 +231,20 @@ a
|
||||
20
|
||||
30
|
||||
31
|
||||
CREATE TABLE t12u(a DOUBLE UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
|
||||
INSERT INTO t12u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
|
||||
ERROR 22003: Out of range value for column 'a' at row 5
|
||||
INSERT INTO t12u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
|
||||
SELECT * FROM t12u;
|
||||
a
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
20
|
||||
30
|
||||
31
|
||||
# Scenario 1: Normal restart, to test if the counters are persisted
|
||||
# Scenario 2: Delete some values, to test the counters should not be the
|
||||
# one which is the largest in current table
|
||||
@@ -981,4 +1007,5 @@ a b
|
||||
10 1
|
||||
2 2
|
||||
3 4
|
||||
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33;
|
||||
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t11u, t12u,
|
||||
t30, t32, t33;
|
||||
|
@@ -82,15 +82,25 @@ INSERT INTO t10 VALUES(0), (0), (0), (0), (8), (10), (0),
|
||||
SELECT * FROM t10;
|
||||
|
||||
CREATE TABLE t11(a FLOAT AUTO_INCREMENT KEY) ENGINE = InnoDB;
|
||||
INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0),
|
||||
(20), (30), (31);
|
||||
INSERT INTO t11 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
|
||||
SELECT * FROM t11;
|
||||
|
||||
CREATE TABLE t11u(a FLOAT UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
INSERT INTO t11u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
|
||||
INSERT INTO t11u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
|
||||
SELECT * FROM t11u;
|
||||
|
||||
CREATE TABLE t12(a DOUBLE AUTO_INCREMENT KEY) ENGINE = InnoDB;
|
||||
INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0),
|
||||
(20), (30), (31);
|
||||
INSERT INTO t12 VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
|
||||
SELECT * FROM t12;
|
||||
|
||||
CREATE TABLE t12u(a DOUBLE UNSIGNED AUTO_INCREMENT KEY) ENGINE = InnoDB;
|
||||
--error ER_WARN_DATA_OUT_OF_RANGE
|
||||
INSERT INTO t12u VALUES(0), (0), (0), (0), (-1), (-10), (0), (20), (30), (31);
|
||||
INSERT INTO t12u VALUES(0), (0), (0), (0), (0), (20), (30), (31);
|
||||
SELECT * FROM t12u;
|
||||
|
||||
--echo # Scenario 1: Normal restart, to test if the counters are persisted
|
||||
--echo # Scenario 2: Delete some values, to test the counters should not be the
|
||||
--echo # one which is the largest in current table
|
||||
@@ -556,4 +566,5 @@ INSERT INTO t33 VALUES(3, NULL);
|
||||
SELECT MAX(b) AS `Expect 4` FROM t33;
|
||||
SELECT * FROM t33;
|
||||
|
||||
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33;
|
||||
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t11u, t12u,
|
||||
t30, t32, t33;
|
||||
|
Reference in New Issue
Block a user