Re: surrogate key or not?
От | Kenneth Gonsalves |
---|---|
Тема | Re: surrogate key or not? |
Дата | |
Msg-id | 0407231532531I.01150@thenilgiris.com обсуждение исходный текст |
Ответ на | Re: surrogate key or not? (Michael Glaesemann <grzm@myrealbox.com>) |
Ответы |
Re: surrogate key or not?
Re: surrogate key or not? Re: surrogate key or not? |
Список | 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 по дате отправления: