pgadmin4/docs/en_US/sequence_dialog.rst

127 lines
5.1 KiB
ReStructuredText
Raw Normal View History

2016-06-21 03:06:44 -05:00
.. _sequence_dialog:
2016-05-13 08:43:57 -05:00
2018-06-15 03:14:12 -05:00
************************
`Sequence Dialog`:index:
************************
2016-05-13 08:43:57 -05:00
Use the *Sequence* dialog to create a sequence. A sequence generates unique
values in a sequential order (not necessarily contiguous).
2016-05-13 08:43:57 -05:00
The *Sequence* dialog organizes the development of a sequence through the
following dialog tabs: *General*, *Definition*, and *Security*. The *SQL* tab
displays the SQL code generated by dialog selections.
2016-05-13 08:43:57 -05:00
2016-05-20 15:39:21 -05:00
.. image:: images/sequence_general.png
:alt: Sequence dialog general tab
:align: center
2016-05-13 08:43:57 -05:00
Use the fields in the *General* tab to identify a sequence:
* Use the *Name* field to add a descriptive name for the sequence. The name will
be displayed in the *pgAdmin* tree control. The sequence name must be
distinct from the name of any other sequence, table, index, view, or foreign
table in the same schema.
* Use the drop-down listbox next to *Owner* to select the name of the role that
will own the sequence.
* Use the drop-down listbox next to *Schema* to select the schema in which the
sequence will reside.
2016-05-24 07:47:35 -05:00
* Store notes about the sequence in the *Comment* field.
2016-05-13 08:43:57 -05:00
Click the *Definition* tab to continue.
2016-05-20 15:39:21 -05:00
.. image:: images/sequence_definition.png
:alt: Sequence dialog definition tab
:align: center
2016-05-13 08:43:57 -05:00
Use the fields in the *Definition* tab to define the sequence:
* Use the *Increment* field to specify which value is added to the current
sequence value to create a new value.
* Provide a value in the *Start* field to specify the beginning value of the
sequence. The default starting value is MINVALUE for ascending sequences and
MAXVALUE for descending ones.
* Provide a value in the *Minimum* field to specify the minimum value a sequence
can generate. If this clause is not supplied or NO MINVALUE is specified,
then defaults will be used. The defaults are 1 and -263-1 for ascending and
descending sequences, respectively.
* Provide a value in the *Maximum* field to specify the maximum value for the
sequence. If this clause is not supplied or NO MAXVALUE is specified, then
default values will be used. The defaults are 263-1 and -1 for ascending and
descending sequences, respectively.
* Provide a value in the *Cache* field to specify how many sequence numbers are
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), and this is
also the default.
* Move the *Cycled* switch to the *Yes* position to allow the sequence to wrap
around when the MAXVALUE or the MINVALUE has been reached by an ascending or
descending sequence respectively. If the limit is reached, the next number
generated will be the MINVALUE or MAXVALUE, respectively. The default is *No*.
2016-05-13 08:43:57 -05:00
Click the *Security* tab to continue.
2016-05-20 15:39:21 -05:00
.. image:: images/sequence_security.png
:alt: Sequence dialog security tab
:align: center
2016-05-13 08:43:57 -05:00
Use the *Security* tab to assign privileges and define security labels for the
sequence.
2016-05-13 08:43:57 -05:00
Use the *Privileges* panel to assign privileges. Click the *Add* icon (+) to
set privileges:
2016-05-13 08:43:57 -05:00
* Select the name of a role that will be granted privileges from the drop-down
listbox in the *Grantee* field.
* Click inside the *Privileges* field. Check the boxes to the left of one or
more privileges to grant the selected privilege to the specified user.
* Select the name of the role from the drop-down listbox in the *Grantor*
field. The default grantor is the owner of the database.
2016-05-13 08:43:57 -05:00
Click the *Add* icon (+) to assign additional privileges; to discard a
privilege, click the trash icon to the left of the row and confirm deletion in
the *Delete Row* popup.
2016-05-13 08:43:57 -05:00
Use the *Security Labels* panel to define security labels applied to the
sequence. Click the *Add* icon (+) to add each security label selection:
2016-05-13 08:43:57 -05:00
* Specify a security label provider in the *Provider* field. The named provider
must be loaded and must consent to the proposed labeling operation.
* Specify a a security label in the *Security Label* field. The meaning of a
given label is at the discretion of the label provider. PostgreSQL places no
restrictions on whether or how a label provider must interpret security
labels; it merely provides a mechanism for storing them.
2016-05-13 08:43:57 -05:00
Click the *Add* icon (+) to assign additional security labels; to discard a
security label, click the trash icon to the left of the row and confirm deletion
in the *Delete Row* popup.
2016-05-13 08:43:57 -05:00
Click the *SQL* tab to continue.
Your entries in the *Sequence* dialog generate a generate a SQL command (see an
example below). Use the *SQL* tab for review; revisit or switch tabs to make any
changes to the SQL command.
2016-05-24 07:47:35 -05:00
Example
*******
2016-05-24 07:47:35 -05:00
The following is an example of the sql command generated by user selections in
the *Sequence* dialog:
2016-05-13 08:43:57 -05:00
2016-05-20 15:39:21 -05:00
.. image:: images/sequence_sql.png
:alt: Sequence dialog sql tab
:align: center
2016-05-24 07:47:35 -05:00
The example shown demonstrates a sequence named *seconds*. The sequence will
increase in *5* second increments, and stop when it reaches a maximum value
equal of *60*.
* Click the *Info* button (i) to access online help.
2016-05-13 08:43:57 -05:00
* Click the *Save* button to save work.
* Click the *Cancel* button to exit without saving work.
* Click the *Reset* button to restore configuration parameters.
2016-05-13 08:43:57 -05:00