Search Postgresql Archives

Re: Primary Key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ron Johnson <ron.l.johnson@xxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux