From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Primary Key |
Date: | 2007-11-23 17:07:44 |
Message-ID: | 11357.1195837664@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> writes:
> On 11/23/07 03:33, Peter Childs wrote:
>> The worse thing I meet is people who think primary keys need to be
>> integer single field unique serial fields
>>
>> I tend to agree that primary keys should be single fields if they need
>> to be referenced but should also be natural if at all possible. ie use
>> car number plates rather than some serial int.
> I wouldn't trust plate number to be unique over time, since the
> format "ABC 123" only has a capacity of 17,576,000 vehicles.
There's a worse problem than that: what if you find out that you
mis-entered the value? Now you have to change the record's primary key
in order to stay consistent with the real world. Which is exactly what
a primary key should never have to do, at least in the opinion of those
who recommend synthetic primary keys.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Hart | 2007-11-23 17:26:30 | Re: best way to handle enum type |
Previous Message | Bruce Momjian | 2007-11-23 16:36:10 | Re: [HACKERS] AutoVacuum Behaviour Question |