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

From Ron Johnson
Subject Re: IS it a good practice to use SERIAL as Primary Key?
Date
Msg-id 456BE423.5050705@cox.net
Whole thread Raw
In response to Re: IS it a good practice to use SERIAL as Primary Key?  ("Harald Armin Massa" <haraldarminmassa@gmail.com>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/27/06 23:58, Harald Armin Massa wrote:
> Ron,
>
>>
>> > In the "real world" there is no such thing as a primary key. At least
>> not
>> > over time. Not enough people understand the concept of a primary key to
>> > make those things existent in the real world.
>>
>> There are lots of numbers.  Credit card numbers, account numbers
>> sales ticket numbers, etc, etc ad nauseum.  Julian day and Julian
>> date, even.  You can't have lived in "the west" in the past 30 years
>> without being surrounded by them.
>
>
> Yes. There are a lot of numbers, but I the concept of a "primary key" is
> totally different from the concept of "number".
>
> a "Primary Key" is supposed to identify <something< across time and space.
>
> Some time people thought that an IP-Number will do this... soonly after
> there was NAT.
>
> Again, somebody thougt, "every microsecond is unique", and then there was
> daylight saving.

Until we get to velocities near c, every microsecond (ticks in
OpenVMS are 100ns intervals, 0.1us, but that's just getting picky)
*is* unique.

But since DST is a valid concern, that's why you don't store the
string 'YYYY-AA-DD HH:MM:SS.mmmm', you store a bigint with the ticks
since epoch, and let the app interpret into environment-appropriate
form.

> Who gives guarantees that credit card numbers will not get reused after
> years of inactivity?
>
> Yes, there are natural keys, and it's good to use them to identify things
> for humans. But I got bitten many times by using them as primary. Many
> things that "will not change, ever", just were changed on the next meeting.

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

iD8DBQFFa+QjS9HxQb37XmcRAv6OAJ42fE2FSdhCdaySH1GUczpJlP1B1gCg1TpE
OLTs3bhPVqT4YaFaNvMEbI0=
=ktpr
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: "Doron Baranes"
Date:
Subject: Re: Solaris 10 problem
Next
From: Thomas Kellerer
Date:
Subject: Re: Development of cross-platform GUI for Open Source DBs