Re: Is PRIMARY KEY the same as UNIQUE NOT NULL?
| От | Tom Lane |
|---|---|
| Тема | Re: Is PRIMARY KEY the same as UNIQUE NOT NULL? |
| Дата | |
| Msg-id | 67717.1454259758@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Is PRIMARY KEY the same as UNIQUE NOT NULL? (Harald Fuchs <hari.fuchs@gmail.com>) |
| Ответы |
Re: Is PRIMARY KEY the same as UNIQUE NOT NULL?
Re: Is PRIMARY KEY the same as UNIQUE NOT NULL? |
| Список | pgsql-general |
Harald Fuchs <hari.fuchs@gmail.com> writes:
> Ben Leslie <benno@benno.id.au> writes:
>> "Technically, PRIMARY KEY is merely a combination of UNIQUE and NOT NULL"
>>
>> I wanted to clarify if that was, technically, true.
> Yes, but see below.
>> "identifying a set of columns as primary key also provides metadata
>> about the design of the schema, as a primary key implies that other
>> tables can rely on this set of columns as a unique identifier for
>> rows."
Yeah. The extra metadata has several other effects. Perhaps it would be
better to reword this sentence to make it clear that PRIMARY KEY is
equivalent to UNIQUE+NOTNULL in terms of the data constraint that it
enforces, without implying that there is no other difference. I'm not
sure about a short and clear expression of that though ...
regards, tom lane
В списке pgsql-general по дате отправления: