ALTER SEQUENCE applies a to a sequence.
The
ALTER SEQUENCE 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. - To rename a sequence with
ALTER SEQUENCE ... RENAME TO, the user must have theDROPon the sequence and theCREATEprivilege on the sequence’s database.
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:

