sequence data type

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: sequence data type
Date: 2016-08-31 04:22:24
Message-ID: 898deb94-5265-37cf-f199-4f79ef864536@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-Add-CREATE-SEQUENCE-AS-data-type-clause.patch text/x-patch 36.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-08-31 04:32:26 Re: ICU integration
Previous Message Peter Eisentraut 2016-08-31 04:12:34 Re: ICU integration