Re: PostgreSQL Developer Best Practices - Mailing list pgsql-general

From Adrian Klaver
Subject Re: PostgreSQL Developer Best Practices
Date
Msg-id 55DD0839.3060400@aklaver.com
Whole thread Raw
In response to Re: PostgreSQL Developer Best Practices  (Melvin Davidson <melvin6925@gmail.com>)
Responses Re: PostgreSQL Developer Best Practices
List pgsql-general
On 08/25/2015 05:17 PM, Melvin Davidson wrote:
> I think a lot of people here are missing the point. I was trying to give
> examples of natural keys, but a lot of people are taking great delight
> in pointing out exceptions to examples, rather than understanding the point.
> So for the sake of argument, a natural key is something that in itself
> is unique and the possibility of a duplicate does not exist.
> Before ANYONE continues to insist that a serial id column is good,
> consider the case where the number of tuples will exceed a bigint.
> Don't say it cannot happen, because it can.
> However, if you have an alphanumeric field, let's say varchar 50, and
> it's guaranteed that it will never have a duplicate, then THAT is a
> natural primary

That is a big IF and a guarantee I would not put money on.

> key and beats the hell out of a generic "id" field.
>
> Further to the point, since I started this thread, I am holding to it
> and will not discuss "natural primary keys" any further.
>



--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Gavin Flower
Date:
Subject: Re: PostgreSQL Developer Best Practices
Next
From: Adrian Klaver
Date:
Subject: Re: PostgreSQL Developer Best Practices