Skip to content

Sequence

Defines a sequence object

Properties

Property Type Required Description
schema string — The schema the sequence is created in.
name string — The sequence name.
owner string — The role that owns the sequence.
sql string — User-provided raw SQL snippet.
data_type smallint | SMALLINT | int2 | INT2 | integer | INTEGER | int4 | INT4 | bigint | BIGINT | int8 | INT8 — Specifies the data type of the sequence. Default: "BIGINT".
increment_by integer — Specifies which value is added to the current sequence value to create a new value. A positive value will make an ascending sequence, a negative one a descending sequence. Default: 1.
min_value integer — Specifies the minimum value a sequence can generate. Default: 1.
max_value integer — Specifies the maximum value for the sequence.
start_with integer — Specifies the value to start the sequence at.
cache integer — Sspecifies how many sequence numbers are to be preallocated and stored in memory for faster access. Default: 1.
cycle boolean — When set to true, the sequence can wrap around when it hits the maximum value. When false, the sequence will return an error when it hits the maximum value.
owned_by string — Specifies the schema.table.column that owns the column. In pglifecycle this setting will allow the sequence to automatically be set when DML is provided for a table that has a sequence column.
comment string — An optional comment about the sequence.
security_labels security_labels — Security Labels.

Mutually exclusive forms

Exactly one of these must hold:

  • schema and name
  • sql, without data_type or increment_by or min_value or max_value or start_with or cache or cycle

No other properties are accepted.


Source: schemata/sequence.yml · Resolved JSON Schema: sequence.json