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:Steve Singer <steve@ssinger.info> Reviewed-by:
Michael Paquier <michael.paquier@gmail.com>
Showing
Please register or sign in to comment