Re: Mistakes between an example and its description - Mailing list pgsql-docs

From David G. Johnston
Subject Re: Mistakes between an example and its description
Date
Msg-id CAKFQuwboFbkC7sfZ9RAaEg5oBkAk5rEt3-=Ein__+VB01oxpMA@mail.gmail.com
Whole thread Raw
In response to Re: Mistakes between an example and its description  (Martín Marqués <martin@2ndquadrant.com>)
List 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 by date:

Previous
From: Martín Marqués
Date:
Subject: Re: Mistakes between an example and its description
Next
From: PG Doc comments form
Date:
Subject: Postgres upgrade trouble