Re: Typo in doc or wrong EXCLUDE implementation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Typo in doc or wrong EXCLUDE implementation
Date
Msg-id 25606.1533843069@sss.pgh.pa.us
Whole thread Raw
In response to Re: Typo in doc or wrong EXCLUDE implementation  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Typo in doc or wrong EXCLUDE implementation
Re: Typo in doc or wrong EXCLUDE implementation
List pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> On Thu, Aug 9, 2018 at 01:11:05PM +0300, KES wrote:
>> Why surprising? It is
>> [documented](https://www.postgresql.org/docs/current/static/sql-create
>> table.html#sql-createtable-exclude):
>>> If all of the specified operators test for equality, this is
>>> equivalent to a UNIQUE constraint, although an ordinary unique
>>> constraint will be faster.

>> Thus the UNIQUE constraint is just particular case of exclusion
>> constraint, is not?

> Well, for me a UNIQUE constraint guarantees each discrete value is
> unique, while exclusion constraint says discrete or ranges or geometric
> types don't overlap.  I realize equality is a special case of discrete,
> but having such cases be marked as UNIQUE seems too confusing.

I think the OP is reading "equivalent" literally, as meaning that
an EXCLUDE with operators that act like equality is treated as being
the same as UNIQUE for *every* purpose.  We're not going there, IMO,
so probably we need to tweak the doc wording a little.  Perhaps
writing "functionally equivalent" would be better?  Or instead of
"is equivalent to", write "imposes the same restriction as"?

            regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Typo in doc or wrong EXCLUDE implementation
Next
From: Nico Williams
Date:
Subject: Re: [FEATURE REQUEST] Encrypted indexes over encrypted data