Re: surrogate key or not? - Mailing list pgsql-sql

From Kenneth Gonsalves
Subject Re: surrogate key or not?
Date
Msg-id 0407231532531I.01150@thenilgiris.com
Whole thread Raw
In response to Re: surrogate key or not?  (Michael Glaesemann <grzm@myrealbox.com>)
Responses Re: surrogate key or not?  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Re: surrogate key or not?  (Janning Vygen <vygen@gmx.de>)
Re: surrogate key or not?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: surrogate key or not?
Next
From: Achilleus Mantzios
Date:
Subject: Re: surrogate key or not?