Skip to content
Snippets Groups Projects
Commit 2ea5b06c authored by Peter Eisentraut's avatar Peter Eisentraut
Browse files

Add CREATE SEQUENCE AS <data type> clause


This stores a data type, required to be an integer type, with the
sequence.  The sequences min and max values default to the range
supported by the type, and they cannot be set to values exceeding that
range.  The internal implementation of the sequence is not affected.

Change the serial types to create sequences of the appropriate type.
This makes sure that the min and max values of the sequence for a serial
column match the range of values supported by the table column.  So the
sequence can no longer overflow the table column.

This also makes monitoring for sequence exhaustion/wraparound easier,
which currently requires various contortions to cross-reference the
sequences with the table columns they are used with.

This commit also effectively reverts the pg_sequence column reordering
in f3b421da, because the new seqtypid
column allows us to fill the hole in the struct and create a more
natural overall column ordering.

Reviewed-by: default avatarSteve Singer <steve@ssinger.info>
Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
parent 9401883a
No related branches found
No related tags found
Loading
Showing
with 274 additions and 99 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment