Re: Is PRIMARY KEY the same as UNIQUE NOT NULL?

Поиск
Список
Период
Сортировка
От Geoff Winkless
Тема Re: Is PRIMARY KEY the same as UNIQUE NOT NULL?
Дата
Msg-id CAEzk6feisMA88yr4wn1JrWW_pQhPvQt_VKLg6ibULjHwp+u7Cg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Is PRIMARY KEY the same as UNIQUE NOT NULL?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Is PRIMARY KEY the same as UNIQUE NOT NULL?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On 31 January 2016 at 19:53, David G. Johnston
<david.g.johnston@gmail.com> wrote:
> A PRIMARY KEY enforces a UNIQUE, NOT NULL constraint and additionally allows
[snip]

I would just remove the whole paragraph. A primary key does what it
does, a unique constraint does what it does. I'm not really sure why
you need to link them.

I would just start with

"A primary key indicates that a column or group of columns can be used
as a unique identifier for rows in the table."

before the examples, then remove the "Technically" and the whole
parenthesised comment about unique keys and nulls, so the next line
after the examples becomes

"Primary keys are useful both for documentation purposes and for
client applications. For example, a GUI application that allows
modifying row values probably needs to know the primary key of a table
to be able to identify rows uniquely."

I just think it's unnecessarily confusing to start suggesting that
there's some equivalency when you then need to clarify that actually
they're not really equivalent.

Geoff


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

Предыдущее
От: Albe Laurenz
Дата:
Сообщение: Re: PL/pgSQL debugger
Следующее
От: Kaushal Shriyan
Дата:
Сообщение: Re: BDR replication on Postgresql 9.5.0