X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 339864758E6 for ; Wed, 30 Apr 2003 10:21:31 -0400 (EDT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by postgresql.org (Postfix) with ESMTP id C6FE6475458 for ; Wed, 30 Apr 2003 10:21:27 -0400 (EDT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19AsSi-000580-00 for ; Wed, 30 Apr 2003 10:21:32 -0400 Received: by dba2 (Postfix, from userid 1019) id 2FA61CC7B; Wed, 30 Apr 2003 10:21:32 -0400 (EDT) Date: Wed, 30 Apr 2003 10:21:32 -0400 From: Andrew Sullivan To: pgsql-admin@postgresql.org Subject: Re: Impact of loss of unique SERIAL? Message-ID: <20030430142132.GB6618@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-admin@postgresql.org References: <200304300934.32897.mallah@trade-india.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.3i X-Spam-Status: No, hits=-38.0 required=5.0 tests=BAYES_10,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/398 X-Sequence-Number: 8553 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 M2P 2A8 +1 416 646 3304 x110