Re: Primary Key

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Primary Key
Дата
Msg-id 11357.1195837664@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Primary Key  (Ron Johnson <ron.l.johnson@cox.net>)
Список pgsql-general
Ron Johnson <ron.l.johnson@cox.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] AutoVacuum Behaviour Question
Следующее
От: Tom Hart
Дата:
Сообщение: Re: best way to handle enum type