Re: IS it a good practice to use SERIAL as Primary Key? - Mailing list pgsql-general

From Joshua D. Drake
Subject Re: IS it a good practice to use SERIAL as Primary Key?
Date
Msg-id 1164669941.6398.28.camel@localhost.localdomain
Whole thread Raw
In response to Re: IS it a good practice to use SERIAL as Primary Key?  (John McCawley <nospam@hardgeus.com>)
Responses Re: IS it a good practice to use SERIAL as Primary Key?  (John McCawley <nospam@hardgeus.com>)
Re: IS it a good practice to use SERIAL as Primary Key?  (Scott Ribe <scott_ribe@killerbytes.com>)
Re: IS it a good practice to use SERIAL as Primary Key?  (Ron Johnson <ron.l.johnson@cox.net>)
Re: IS it a good practice to use SERIAL as Primary Key?  ("Daniel Serodio" <dserodio@gmail.com>)
List pgsql-general
On Mon, 2006-11-27 at 17:09 -0600, John McCawley wrote:
> This list represents the most informed database admins I know, and while
> the conversation can easily devolve into minutae, I am genuinely
> interested in everyone's opinions on this subject.  Primary keys are a
> pretty central aspect of database design, and most everyone on this list
> has unique experiences with the pros and cons of each approach...I'm
> pretty interested in the discussion.

Well sure, but the conversation was no longer productive. People were
getting stuck on what amounted to a very trivial example. There were
huge problems with that example and it in no way could represent an
legitimate use in production without a whole lot of caveats.

If we want to have a discussion about artificial versus natural keys,
rock on.. but the answer is simple:

A artificial does not protect against duplication.

That's it, in a nut shell. There is no argument there. That is why you
don't use artificial keys. That said... pretty much every table I create
will have an artificial key... because it makes managing data easy. An
example (to reuse the simple example):

users
=====
id serial unique,
first_name text,
last_name text,
primary key (first_name,last_name)

Yes there are problems with the above, namely you will likely have more
than one joshua drake.

Sincerely,

Joshua D. Drake


>
> Joshua D. Drake wrote:
>
> >Please... find something more productive to do.
> >
> >Sincerely,
> >
> >Joshua D. Drake
> >
> >
> >
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
>
--

      === 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




pgsql-general by date:

Previous
From: John McCawley
Date:
Subject: Re: IS it a good practice to use SERIAL as Primary Key?
Next
From: John McCawley
Date:
Subject: Re: IS it a good practice to use SERIAL as Primary Key?