From: Michael Glaesemann <grzm@myrealbox.com>
To: Kenneth Gonsalves <lawgon@thenilgiris.com>
Cc: Karsten Hilbert <Karsten.Hilbert@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: surrogate key or not?
Date: Fri, 23 Jul 2004 20:17:37 +0900
Message-ID: <E7829CAA-DC99-11D8-AA48-000A95C88220@myrealbox.com> (raw)
In-Reply-To: <0407231430101G.01150@thenilgiris.com>
References: <1090325769.3241.27.camel@dicaprio.akademie1.de>
<0407231327461F.01150@thenilgiris.com>
<FF7F62AC-DC8E-11D8-AA48-000A95C88220@myrealbox.com>
<0407231430101G.01150@thenilgiris.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: grzm@myrealbox.com, lawgon@thenilgiris.com, Karsten.Hilbert@gmx.net
Subject: Re: surrogate key or not?
In-Reply-To: <E7829CAA-DC99-11D8-AA48-000A95C88220@myrealbox.com>
References: <1090325769.3241.27.camel@dicaprio.akademie1.de> <0407231327461F.01150@thenilgiris.com> <FF7F62AC-DC8E-11D8-AA48-000A95C88220@myrealbox.com> <0407231430101G.01150@thenilgiris.com> <E7829CAA-DC99-11D8-AA48-000A95C88220@myrealbox.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox