Search Postgresql Archives

Re: IS it a good practice to use SERIAL as Primary Key?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux