4036
MariaDBERRORCommonSequenceHIGH confidence
Sequence value is out of bounds or invalid
What this means
ER_SEQUENCE_INVALID_DATA (4036) is returned when a SETVAL() call or a sequence definition contains invalid or inconsistent values — for example, START is greater than MAXVALUE, or INCREMENT is 0.
How to reproduce
trigger — this will error
trigger — this will error
CREATE SEQUENCE s START WITH 100 MAXVALUE 50; -- START (100) > MAXVALUE (50) — invalid
expected output
ERROR 4036 (HY000): Sequence 's' has out of range value for its options
Fix
Ensure START <= MAXVALUE and INCREMENT != 0
WHEN Creating or altering a sequence.
Ensure START <= MAXVALUE and INCREMENT != 0
CREATE SEQUENCE s START WITH 1 MINVALUE 1 MAXVALUE 9999999999 INCREMENT BY 1 NO CYCLE;
Why this works
A valid sequence requires: MINVALUE <= START <= MAXVALUE and INCREMENT != 0. These constraints are documented in the CREATE SEQUENCE reference.
Version notes
MariaDB 10.3
SEQUENCE is a MariaDB-specific feature; MySQL uses AUTO_INCREMENT instead.
Sources
Official documentation ↗
MariaDB — CREATE SEQUENCE
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev