From: Andrew Sullivan <andrew@libertyrms.info>
To: pgsql-admin@postgresql.org
Subject: Re: Impact of loss of unique SERIAL?
Date: Wed, 30 Apr 2003 10:21:32 -0400
Message-ID: <20030430142132.GB6618@libertyrms.info> (raw)
In-Reply-To: <HOEMINGMOAAKJBIFKNJMOENNKFAA.justinlong@strategicnetwork.org>
References: <200304300934.32897.mallah@trade-india.com>
<HOEMINGMOAAKJBIFKNJMOENNKFAA.justinlong@strategicnetwork.org>
On Wed, Apr 30, 2003 at 09:33:03AM -0400, Justin Long wrote:
> 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. Now, I'm no SQL guru, but I'm wondering
SERIAL _columns_ no longer automatically get a unique index on them.
You need to add one if you want to ensure uniqueness there: CREATE
UNIQUE INDEX. . .
> what happens if two INSERTs are done at the "same" time (we have multiple
> web hosts that access one large database server). Would they result in two
> identical values on the SERIAL? We haven't gotten a stupendous amount of
No. The underlying _sequence_, which is what those inserts call, is
still transaction- (and connection-) aware, so you won't have this
problem.
I don't actually recall the argument for removing the automatic
unique index. But it's easy enough at the time of creation, since
you could specify a UNIQUE constraint on the column anyway.
When you upgrade, you should get the unique index, since your dump
will contain it.
A
--
----
Andrew Sullivan 204-4141 Yonge Street
Liberty RMS Toronto, Ontario Canada
<andrew@libertyrms.info> M2P 2A8
+1 416 646 3304 x110
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: andrew@libertyrms.info
Subject: Re: Impact of loss of unique SERIAL?
In-Reply-To: <20030430142132.GB6618@libertyrms.info>
References: <200304300934.32897.mallah@trade-india.com> <HOEMINGMOAAKJBIFKNJMOENNKFAA.justinlong@strategicnetwork.org> <20030430142132.GB6618@libertyrms.info>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox