value for the sequence. If <literal>NO
MAXVALUE</literal> is specified, the defaults of
the maximum value of the data type and -1 for ascending and descending
sequences, respectively, will be used. If neither option is
specified, the current maximum value will be maintained.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>CYCLE</literal></term>
<listitem>
<para>
The optional <literal>CYCLE</literal> key word can be used to enable
the sequence to wrap around when the
<replaceable class="parameter">maxvalue</replaceable> or
<replaceable class="parameter">minvalue</replaceable> has been
reached by
an ascending or descending sequence respectively. If the limit is
reached, the next number generated will be the
<replaceable class="parameter">minvalue</replaceable> or
<replaceable class="parameter">maxvalue</replaceable>,
respectively.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>NO CYCLE</literal></term>
<listitem>
<para>
If the optional <literal>NO CYCLE</literal> key word is
specified, any calls to <function>nextval</function> after the
sequence has reached its maximum value will return an error.
If neither <literal>CYCLE</literal> or <literal>NO
CYCLE</literal> are specified, the old cycle behavior will be
maintained.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">start</replaceable></term>
<listitem>
<para>
The optional clause <literal>START WITH <replaceable
class="parameter">start</replaceable></literal> changes the
recorded start value of the sequence. This has no effect on the
<emphasis>current</emphasis> sequence value; it simply sets the value
that future <command>ALTER SEQUENCE RESTART</command> commands will use.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">restart</replaceable></term>
<listitem>
<para>
The optional clause <literal>RESTART [ WITH <replaceable
class="parameter">restart</replaceable> ]</literal> changes the
current value of the sequence. This is similar to calling the
<function>setval</function> function with <literal>is_called</literal> =
<literal>false</literal>: the specified value will be returned by the
<emphasis>next</emphasis> call of <function>nextval</function>.
Writing <literal>RESTART</literal> with no <replaceable
class="parameter">restart</replaceable> value is equivalent to supplying
the start value that was recorded by <command>CREATE SEQUENCE</command>
or last set by <command>ALTER SEQUENCE START WITH</command>.
</para>
<para>
In contrast to a <function>setval</function> call,
a <literal>RESTART</literal> operation on a sequence is transactional
and blocks concurrent transactions from obtaining numbers from the
same sequence. If that's not the desired mode of
operation, <function>setval</function> should be used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">cache</replaceable></term>
<listitem>
<para>
The clause <literal>CACHE <replaceable
class="parameter">cache</replaceable></literal> enables
sequence numbers to be preallocated and stored in memory for
faster access. The minimum value is 1 (only one value can be
generated at a time, i.e., no cache). If unspecified, the old
cache value will be maintained.
</para>
</listitem>