• Peter Eisentraut's avatar
    Add CREATE SEQUENCE AS <data type> clause · 2ea5b06c
    Peter Eisentraut authored
    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>
    2ea5b06c
sequence.out 22.4 KB