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 ]name
OWNER TO {new_owner
| CURRENT_ROLE | CURRENT_USER | SESSION_USER } ALTER SEQUENCE [ IF EXISTS ]name
RENAME TOnew_name
ALTER SEQUENCE [ IF EXISTS ]name
SET 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 WITH
clause 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 WITH
andMINVALUE
in 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);