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 9C9F9D1B262 for ; Fri, 23 Jul 2004 08:18:04 -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 74573-02 for ; Fri, 23 Jul 2004 11:18:09 +0000 (GMT) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id 6C4E3D1B23E for ; Fri, 23 Jul 2004 08:17:59 -0300 (ADT) Received: from [10.10.14.130] glaesema [61.115.206.98] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 3.89 $ on Novell NetWare; Fri, 23 Jul 2004 05:18:08 -0600 In-Reply-To: <0407231430101G.01150@thenilgiris.com> References: <1090325769.3241.27.camel@dicaprio.akademie1.de> <0407231327461F.01150@thenilgiris.com> <0407231430101G.01150@thenilgiris.com> Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: Karsten Hilbert , pgsql-sql@postgresql.org From: Michael Glaesemann Subject: Re: surrogate key or not? Date: Fri, 23 Jul 2004 20:17:37 +0900 To: Kenneth Gonsalves X-Mailer: Apple Mail (2.618) 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/197 X-Sequence-Number: 18449 On Jul 23, 2004, at 6:00 PM, Kenneth Gonsalves wrote: > On Friday 23 July 2004 03:29 pm, Michael Glaesemann wrote: > >> >> You appear to be misunderstanding the purpose of a primary key. A >> primary key is used to ensure there is a way to identify each row >> uniquely. It is quite independent of which columns you may or may not >> want to search on. If name is not going to be necessarily unique in >> the >> table, it isn't a primary key. > > ive not misunderstood anything. this is one of the tables in question: > > address_type > id serial PRIMARY KEY > name text UNIQUE NOT NULL > > i think it is self explanatory In the example you originally gave, there is no indication of name being a primary key: On Friday 23 July 2004 12:27 pm, Karsten Hilbert 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. Michael Glaesemann grzm myrealbox com