From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: IS it a good practice to use SERIAL as Primary Key? |
Date: | 2006-11-28 00:52:40 |
Message-ID: | 1164675160.6398.39.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 2006-11-27 at 18:14 -0600, Ron Johnson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11/27/06 17:25, Joshua D. Drake wrote:
> > On Mon, 2006-11-27 at 17:09 -0600, John McCawley wrote:
> [snip]
> > 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.
>
> Right, and then the question gets to: how do you create a "good"
> user id? Many prefer serial types; I prefer something that is not a
> monotonically incrementing scalar.
Well what is wrong with using just a serial or bigserial? In that case
specifically?
You could... if you really wanted to...
select md5(id||first_name||last_name) from id;
;)
Joshua D. Drake
>
> - --
> Ron Johnson, Jr.
> Jefferson LA USA
>
> Is "common sense" really valid?
> For example, it is "common sense" to white-power racists that
> whites are superior to blacks, and that those with brown skins
> are mud people.
> However, that "common sense" is obviously wrong.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
>
> iD8DBQFFa39KS9HxQb37XmcRAm+ZAKCAcpky09a2eTYMZX6HZiPIMECfcgCgrkXf
> 9oj3C45XcamX8avi5lYVn98=
> =f0Ct
> -----END PGP SIGNATURE-----
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
--
=== 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 | Joshua D. Drake | 2006-11-28 00:53:46 | Re: IS it a good practice to use SERIAL as Primary Key? |
Previous Message | Tom Lane | 2006-11-28 00:50:25 | Re: NULLs ;-) |