ALTER SEQUENCE
ALTER SEQUENCE — change the definition of a sequence generator
Synopsis
ALTER SEQUENCE [ IF EXISTS ]name[ ASdata_type] [ INCREMENT [ BY ]increment] [ MINVALUEminvalue| NO MINVALUE ] [ MAXVALUEmaxvalue| NO MAXVALUE ] [ RESTART [ [ WITH ]restart] ] [ CACHEcache] [ [ NO ] CYCLE ] [ OWNED BY {table_name.column_name| NONE } ] ALTER SEQUENCE [ IF EXISTS ]nameOWNER TO {new_owner| CURRENT_ROLE | CURRENT_USER | SESSION_USER } ALTER SEQUENCE [ IF EXISTS ]nameRENAME TOnew_nameALTER SEQUENCE [ IF EXISTS ]nameSET SCHEMAnew_schema
Description
ALTER SEQUENCE changes the parameters of an existing sequence generator. The extended forms of ALTER SEQUENCE are mostly the same as in PostgreSQL (see ALTER SEQUENCE) except for the following differences:
The minimum sequence value parameter in Shardman works more like a lower boundary on the global interval of available values, so it can only be increased to make sure no duplicate numbers are generated.
The
RESTART WITHclause allows restarting a sequence at any arbitrary lower bound, but in this case, there is no guarantee that previously generated numbers will not repeat.Using both
RESTART WITHandMINVALUEin a single statement is not permitted to avoid confusion.
Examples
Alter the block size parameter of a sequence called serial:
ALTER SEQUENCE serial SET (block_size = 8192);