Re: Surrogate keys (Was: enums) - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Surrogate keys (Was: enums)
Date
Msg-id 87lkxixelh.fsf@stark.xeocode.com
Whole thread Raw
In response to Surrogate keys (Was: enums)  (Leandro Guimarães Faria Corcete DUTRA<leandro@dutra.fastmail.fm>)
List pgsql-hackers
Leandro Guimarães Faria Corcete DUTRA <leandro@dutra.fastmail.fm> writes:

> Certainly decoupling presentation from storage would be nice, but even before 
> that generalised use of surrogate keys seems to me a knee-jerk reaction.

I hate knee-jerk reactions too, but just think of all the pain of people
dealing with databases where they used Social Security numbers for primary
keys. I would never use an attribute that represents some real-world datum as
a primary key any more.

In my experience there are very few occasions where I want a real non-sequence
generated primary key. I've never regretted having a sequence generated
primary key, and I've certainly had occasions to regret not having one.

-- 
greg



pgsql-hackers by date:

Previous
From: "Qingqing Zhou"
Date:
Subject: Re: Warm-up cache may have its virtue
Next
From: korry
Date:
Subject: Coding standards? Recommendations?