CREATE SEQUENCE will enter a new sequence number generator
- into the current data base. This involves creating and initialising a
+ into the current data base. This involves creating and initializing a
new single-row
table with the name seqname.
The generator will be "owned" by the user issuing the command.
Use a query like
-SELECT * FROM sequence_name;
+SELECT * FROM seqname;
to get the parameters of a sequence.
- Aside from fetching the original
- parameters, you can use
+ As an alternative to fetching the
+ parameters from the original definition as above, you can use
-SELECT last_value FROM sequence_name;
+SELECT last_value FROM seqname;
to obtain the last value allocated by any backend.
- parameters, you can use
Unexpected results may be obtained if a cache setting greater than one
is used for a sequence object that will be used concurrently by multiple
- backends. Each backend will allocate "cache" successive sequence values
+ backends. Each backend will allocate and cache successive sequence values
during one access to the sequence object and increase the sequence
object's last_value accordingly. Then, the next cache-1 uses of nextval
within that backend simply return the preallocated values without touching
Notes
- Refer to the DROP SEQUENCE statement to remove a sequence.
+ Use DROP SEQUENCE to remove a sequence.
Each backend uses its own cache to store allocated numbers.
Override restrictions, so system table structures can be modified.
- These tables are typically those with a leading "pg_" in the table name.
+ These tables are typically those with a leading
+ "pg_" in the table name.
-P
- Ignore system indexes to scan/update system tuples. Reindex command
- for system table/indexes requires this option. System tables are
- typically those with a leading "pg_" in the table name.
+ Ignore system indexes to scan/update system
+ tuples. REINDEX for system tables/indexes
+ requires this option. System tables are
+ typically those with a leading "pg_" in the
+ table name.