Commit c6eeacd1 authored by Rucha Deodhar's avatar Rucha Deodhar

MDEV-13005: Fixing bugs in SEQUENCE, part 3, 3/5

Task 3:
Added an additional condition for SEQUENCE option to check if cache < 0.
parent 0b9842a3
......@@ -698,3 +698,6 @@ ERROR 42S02: Unknown SEQUENCE: 'x'
# Task 2:
CREATE SEQUENCE x START WITH 1 INCREMENT BY 123456789012345678;
ERROR HY000: Sequence 'test.x' has out of range value for options
# Task 3:
CREATE SEQUENCE seq1 START WITH 1 cache -1;
ERROR HY000: Sequence 'test.seq1' has out of range value for options
......@@ -529,3 +529,7 @@ SET @x = PREVIOUS VALUE FOR x;
--echo # Task 2:
--error ER_SEQUENCE_INVALID_DATA
CREATE SEQUENCE x START WITH 1 INCREMENT BY 123456789012345678;
--echo # Task 3:
--error ER_SEQUENCE_INVALID_DATA
CREATE SEQUENCE seq1 START WITH 1 cache -1;
......@@ -121,7 +121,7 @@ bool sequence_definition::check_and_adjust(bool set_reserved_until)
start >= min_value &&
max_value != LONGLONG_MAX &&
min_value != LONGLONG_MIN &&
cache < (LONGLONG_MAX - max_increment) / max_increment &&
cache >= 0 && cache < (LONGLONG_MAX - max_increment) / max_increment &&
((real_increment > 0 && reserved_until >= min_value) ||
(real_increment < 0 && reserved_until <= max_value)))
DBUG_RETURN(FALSE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment