Re: Impact of loss of unique SERIAL?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Justin Long" <justinlong(at)strategicnetwork(dot)org>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Impact of loss of unique SERIAL?
Date: 2003-04-30 14:35:12
Message-ID: 22080.1051713312@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Justin Long" <justinlong(at)strategicnetwork(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Jodi Kanter 2003-04-30 14:56:32 LC_CTYPE
Previous Message Stephan Szabo 2003-04-30 14:23:11 Re: Impact of loss of unique SERIAL?