Re: Impact of loss of unique SERIAL? - Mailing list pgsql-admin

From Tom Lane
Subject Re: Impact of loss of unique SERIAL?
Date
Msg-id 22080.1051713312@sss.pgh.pa.us
Whole thread Raw
In response to Impact of loss of unique SERIAL?  ("Justin Long" <justinlong@strategicnetwork.org>)
List pgsql-admin
"Justin Long" <justinlong@strategicnetwork.org> writes:
> We have been running Postgres 7.2.x for our website, and are considering the
> upgrade to 7.3.x. However, in reading through the changelogs I notice that
> SERIAL values are no longer unique.

You misread it.  SERIAL does not automatically create a unique index on
the column anymore, but the sequence mechanism hasn't changed.  If you
want a unique index, you just say "SERIAL UNIQUE" instead of "SERIAL".
The index is mainly useful as a backstop to guarantee you don't mess up
(eg, by manually inserting values into the column rather than letting
them be taken from the sequence).  Some might see it as unnecessary
overhead.

            regards, tom lane


pgsql-admin by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Impact of loss of unique SERIAL?
Next
From: Jodi Kanter
Date:
Subject: LC_CTYPE