IF EXISTS | Modify the sequence only if it exists; if it does not exist, do not return an error. |
sequence_name | The name of the sequence. |
RENAME TO sequence_name | Rename the sequence to sequence_name, which must be unique to its database and follow these identifier rules. Name changes do not propagate to the table(s) using the sequence. RENAME TO only changes the name of the sequence; it cannot move the sequence to a different database or schema. To change a sequence’s schema, use ALTER SEQUENCE ... SET SCHEMA instead. |
CYCLE/NO CYCLE | The sequence will wrap around when the sequence value reaches the maximum or minimum value. CYCLE is not implemented. If NO CYCLE is set, the sequence will not wrap. |
OWNED BY column_name | Associates the sequence to a particular column. If that column or its parent table is dropped, the sequence will also be dropped. Specifying an owner column with OWNED BY replaces any existing owner column on the sequence. To remove existing column ownership on the sequence and make the column free-standing, specify OWNED BY NONE. Default:NONE |
CACHE | The number of sequence values to cache in memory at the node level. All sessions on the node share the same cache, which can be concurrently accessed, and which reduces the chance of creating large gaps between generated IDs. A cache size of 1 means that there is no cache, and cache sizes of less than 1 are not valid. Default:1 (sequences are not cached by default). While this parameter caches sequences per node, to cache sequence values per session, use PER SESSION CACHE explicitly. |
PER NODE CACHE | The number of sequence values to cache in memory at the node level. All sessions on the node share the same cache, which can be concurrently accessed, and which reduces the chance of creating large gaps between generated IDs. A cache size of 1 means that there is no cache, and cache sizes of less than 1 are not valid. This is the default caching strategy, and is equivalent to specifying CACHE. |
PER SESSION CACHE | The number of sequence values to cache in memory for reuse within a single session. A cache size of 1 means that there is no cache, and cache sizes of less than 1 are not valid. |
MINVALUE | The new minimum value of the sequence. Default:1 |
MAXVALUE | The new maximum value of the sequence. Default:9223372036854775807 |
INCREMENT | The new value by which the sequence is incremented. A negative number creates a descending sequence. A positive number creates an ascending sequence. |
START [WITH] | The value the sequence starts at if you RESTART or if the sequence reaches MAXVALUE and CYCLE is set. |
RESTART [WITH] | Sets nextval to the specified number, or back to the original START value. |
VIRTUAL | Creates a virtual sequence. Virtual sequences are sequences that do not generate monotonically increasing values and instead produce values like those generated by the built-in function unique_rowid(). They are intended for use in combination with SERIAL-typed columns. |
SET SCHEMA schema_name | Change the schema of the sequence to schema_name. |
OWNER TO role_spec | Change the owner of the sequence to role_spec. |