1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Bug#39828 : Autoinc wraps around when offset and increment > 1

Auto increment value wraps when performing a bulk insert with
auto_increment_increment and auto_increment_offset greater than
one.
The fix:
If overflow happened then return MAX_ULONGLONG value as an
indication of overflow and check this before storing the
value into the field in update_auto_increment().
This commit is contained in:
Sergey Glukhov
2010-12-13 14:48:12 +03:00
parent 4096f35a39
commit 0e77c3295a
7 changed files with 88 additions and 118 deletions

View File

@@ -342,3 +342,24 @@ SELECT a FROM t2;
DROP TABLE t1, t2;
--echo #
--echo # Bug#39828 autoinc wraps around when offset and increment > 1
--echo #
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) engine=MyISAM;
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES (18446744073709551601);
SET @@SESSION.AUTO_INCREMENT_INCREMENT=10;
SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
--error ER_WARN_DATA_OUT_OF_RANGE
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=default;
SET @@SESSION.AUTO_INCREMENT_OFFSET=default;
DROP TABLE t1;
--echo End of 5.1 tests