Here is a patch that adds the notion of a data type to a sequence. So
it might be CREATE SEQUENCE foo AS integer. The types are restricted to
int{2,4,8} as now.
The main point of this is to make monitoring sequences less complicated.
Right now, a serial column creates an int4 column but creates the
sequence with a max value for int8. So in order to correctly answer the
question, is the sequence about to run out, you need to look not only at
the sequence but also any columns it is associated with. check_postgres
figures this out, but it's complicated and slow, and not easy to do
manually.
If you tell the sequence the data type you have in mind, it
automatically sets appropriate min and max values. Serial columns also
make use of this, so the sequence type automatically matches the column
type.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services