Sequences
|
Auto-incrementing sequence of int64. | |
|
Increments the given sequence to its next value and returns that value. | |
|
Resets a sequence to initial state or a given value, returning the value. |
An auto-incrementing sequence of int64.
This type can be used to create auto-incrementing properties:
scalar type TicketNo extending sequence;
type Ticket {
number: TicketNo {
constraint exclusive;
}
}A sequence is bound to the scalar type, not to the property, so
if multiple properties use the same sequence, they will
share the same counter. For each distinct counter, a separate
scalar type that is extending sequence should be used.
Increments the given sequence to its next value and returns that value.
See the note on specifying your sequence for best practices on supplying the seq parameter.
Sequence advancement is done atomically; each concurrent session and transaction will receive a distinct sequence value.
db>
select sequence_next(introspect MySequence);{11}Resets a sequence to initial state or a given value, returning the value.
See the note on specifying your sequence for best practices on supplying the seq parameter.
The single-parameter form resets the sequence to its initial state, where
the next sequence_next() call will return the first value in
sequence. The two-parameter form allows you to set the current value of the
sequence. The next sequence_next() call will return the value
after the one you passed to sequence_reset().
db>
select sequence_reset(introspect MySequence);{1}db>
select sequence_next(introspect MySequence);{1}db>
select