ALTER SEQUENCE applies a to a sequence.
The “ statement performs a schema change. For more information about how online schema changes work in CockroachDB, see .
Required privileges
- To alter a sequence, the user must be the owner of the sequence.
- To change the schema of a sequence with
ALTER SEQUENCE ... SET SCHEMA, the user must have theDROPon the sequence and theCREATEprivilege on the new schema. - New in v26.3: To rename a sequence with
ALTER SEQUENCE ... RENAME TO, the user must have theDROPon the sequence and theCREATEprivilege on the sequence’s schema.
Syntax
Parameters
Examples
Change the increment value of a sequence
In this example, we’re going to change the increment value of a sequence from its current state (i.e.,1) to 2.
Rename a sequence
In this example, we will change the name of sequence.Change the schema of a sequence
Suppose you that you would like to add to a new schema calledcockroach_labs:
public schema:
Known limitations
- Altering the minimum or maximum value of a series does not check the current value of a series. This means that it is possible to silently set the maximum to a value less than, or a minimum value greater than, the current value.

