sequence data type - Mailing list pgsql-hackers

From Peter Eisentraut
Subject sequence data type
Date
Msg-id 898deb94-5265-37cf-f199-4f79ef864536@2ndquadrant.com
Whole thread Raw
Responses Re: sequence data type  (Vik Fearing <vik@2ndquadrant.fr>)
Re: [HACKERS] sequence data type  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: ICU integration
Next
From: Michael Paquier
Date:
Subject: Re: ICU integration