X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 384BBD1B19A for ; Fri, 23 Jul 2004 09:03:41 -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 89160-05 for ; Fri, 23 Jul 2004 12:03:46 +0000 (GMT) Received: from sharp.noc24x7.com (unknown [69.56.128.138]) by svr1.postgresql.org (Postfix) with ESMTP id 77DC2D1B18A for ; Fri, 23 Jul 2004 09:03:36 -0300 (ADT) Received: from [61.1.218.172] (helo=thenilgiris.com) by sharp.noc24x7.com with asmtp (Exim 4.34) id 1Bnym9-0003H7-Gq; Fri, 23 Jul 2004 17:33:46 +0530 Received: from localhost (localhost [[UNIX: localhost]]) by thenilgiris.com (8.11.2/8.11.2) id i6NA2sO26347; Fri, 23 Jul 2004 15:32:54 +0530 Content-Type: text/plain; charset="iso-8859-1" From: Kenneth Gonsalves To: Michael Glaesemann Subject: Re: surrogate key or not? Date: Fri, 23 Jul 2004 15:32:53 +0530 X-Mailer: KMail [version 1.2] Cc: Karsten Hilbert , pgsql-sql@postgresql.org References: <1090325769.3241.27.camel@dicaprio.akademie1.de> <0407231430101G.01150@thenilgiris.com> In-Reply-To: MIME-Version: 1.0 Message-Id: <0407231532531I.01150@thenilgiris.com> Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sharp.noc24x7.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - thenilgiris.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/198 X-Sequence-Number: 18450 On Friday 23 July 2004 04:47 pm, Michael Glaesemann wrote: > > id serial unique > > name varchar(25) not null > > primary key is name - after all, you are going to search this on name > > arent > > you? or is there some advantage in doing it your way? > > Also, your explanation "after all, you are going to search..." did not > mention row uniqueness at all. Sorry if this is not what you meant, but > I can only go by what you've written. ok, i'll rephrase the whole thing: i have a master table with two fields: id serial unique name varchar not null (and will be unique) i always make 'name' the primary key, and since it is the primary key, i dont explicitly specify it as unique, and after postgres 7.3 came out, i have added the 'unique' constraint to the 'id' on looking at the gnumed schema, i saw that although 'name' was unique, the serial key, 'id' was made the primary key. So i wondered why and whether there were advantages in doing it this way. -- regards kg http://www.onlineindianhotels.net - hotel bookings reservations in over 4600 hotels in India http://www.ootygolfclub.org