Re: Mistakes between an example and its description

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Martín Marqués <martin(at)2ndquadrant(dot)com>
Cc: Eugene Wang <eugenewangfw(at)gmail(dot)com>, pgsql-docs(at)lists(dot)postgresql(dot)org, PG Doc comments form <noreply(at)postgresql(dot)org>
Subject: Re: Mistakes between an example and its description
Date: 2018-05-10 19:39:16
Message-ID: CAKFQuwboFbkC7sfZ9RAaEg5oBkAk5rEt3-=Ein__+VB01oxpMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thu, May 10, 2018 at 12:16 PM, Martín Marqués <martin(at)2ndquadrant(dot)com>
wrote:

> 2018-05-10 16:04 GMT-03:00 Eugene Wang <eugenewangfw(at)gmail(dot)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.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2018-05-11 07:15:41 Postgres upgrade trouble
Previous Message Martín Marqués 2018-05-10 19:16:43 Re: Mistakes between an example and its description