Re: Mistakes between an example and its description

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Mistakes between an example and its description
Дата
Msg-id CAKFQuwboFbkC7sfZ9RAaEg5oBkAk5rEt3-=Ein__+VB01oxpMA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Mistakes between an example and its description  (Martín Marqués <martin@2ndquadrant.com>)
Список pgsql-docs
On Thu, May 10, 2018 at 12:16 PM, Martín Marqués <martin@2ndquadrant.com> wrote:
2018-05-10 16:04 GMT-03:00 Eugene Wang <eugenewangfw@gmail.com>:
> Unique Constraint and Unique Index should be the same in this single-column
> case, right?

The unique index is what enforces the uniqueness of the field with a
UNIQUE constraint, but a unique index is not necessarily a constraint.

​Specifically, a constraint cannot have a WHERE clause while the index can (i.e., unique indexes can be partial, unique constraints always cover the entire table).

Thinking this over I'd probably remove UNIQUE from both existing examples.  I'd then add an example of a partial unique index (especially since we lack an example of a partial index presently) - and note that non-partial unique indexes are better implemented by defining a constraint on the relation as opposed to creating the index explicitly.

David J.

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

Предыдущее
От: Martín Marqués
Дата:
Сообщение: Re: Mistakes between an example and its description
Следующее
От: PG Doc comments form
Дата:
Сообщение: Postgres upgrade trouble