From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | Scott Ribe <scott_ribe(at)killerbytes(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: IS it a good practice to use SERIAL as Primary Key? |
Date: | 2006-11-27 22:36:36 |
Message-ID: | 1164666996.6398.1.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 2006-11-27 at 14:36 -0700, Scott Ribe wrote:
> > insert a new address, and update the users table to the new address_id
>
> Which changes the user's "primary key". My point was that having the address
> id be part of the primary key is wrong.
As I said, you don't *have* to do it that way. I was just giving an
example. You could just as easily grab the address id, insert that into
an archive table with a date stamp and then just update the address
itself. Thus *not* changing the "Primary Key".
Joshua D. Drake
> Having it be a part of a key may be
> fine for many uses. But it's contrary to the notion of primary key that
> something that not only can, but will, change for many records should be
> part of the primary key. "Unique" and "primary" are *not* synonyms.
>
--
=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-11-27 22:39:30 | Re: Unexpected sort order. |
Previous Message | Scott Ribe | 2006-11-27 22:32:34 | Re: IS it a good practice to use SERIAL as Primary Key? |