X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B4D24D9843 for ; Mon, 26 Sep 2005 23:52:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76450-10 for ; Tue, 27 Sep 2005 02:52:14 +0000 (GMT) Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by svr1.postgresql.org (Postfix) with ESMTP id 968ADD9826 for ; Mon, 26 Sep 2005 23:52:13 -0300 (ADT) Received: from [192.168.1.12] ([68.239.68.205]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0ING00D9AFZ6RI23@vms046.mailsrvcs.net> for pgsql-sql@postgresql.org; Mon, 26 Sep 2005 21:52:18 -0500 (CDT) Date: Mon, 26 Sep 2005 22:53:25 -0400 From: Ferindo Middleton Jr Subject: Re: Why doesn't the SERIAL data type automatically have a UNIQUE In-reply-to: <5899.1127782998@sss.pgh.pa.us> To: Tom Lane Cc: pgsql-sql@postgresql.org Reply-To: fmiddleton@verizon.net Message-id: <4338B425.1010002@verizon.net> Organization: Sleek Collar MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <4338961E.20100@verizon.net> <5899.1127782998@sss.pgh.pa.us> User-Agent: Thunderbird 1.4 (Windows/20050908) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.352 required=5 tests=[AWL=-0.398, DNS_FROM_RFC_ABUSE=0.374, DNS_FROM_RFC_POST=1.376] X-Spam-Level: * X-Archive-Number: 200509/261 X-Sequence-Number: 22808 You're right, Tom. I'm sure someone has a use for a serial field that isn't unique. I just assumed that it was. I guess I didn't read the documentation closely enough. At any rate, I had a table using a serial field that I had to restore to a previous date when I noticed that I forgot to set the sequence to the most recent value... user continued adding data to this table and it started causing some problems. It just seems like most situations would want it unique... to ensure integrity. But I guess you need to choose constraint for built-in data types that follow more of a one-size-fits-all philosophy. And hey, how hard can it be to add the word UNIQUE when I'm creating tables? Ferindo Tom Lane wrote: > Ferindo Middleton Jr writes: > >> Is there some reason why the SERIAL data type doesn't automatically have >> a UNIQUE CONSTRAINT. >> > > It used to, and then we decoupled it. I don't think "I have no use for > one without the other" translates to an argument that no one has a use > for it ... > > regards, tom lane > >