Re: Typo in doc or wrong EXCLUDE implementation

From: KES <kes-kes(at)yandex(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Typo in doc or wrong EXCLUDE implementation
Date: 2018-08-10 09:10:47
Message-ID: 43021481533892247@sas1-ea1d14049a51.qloud-c.yandex.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

huh, maybe you are right, I missread that. English is not my native language.
Actually I come there from FK constraints.

Would it be sufficient for FK require not UNIQUEs, but **allow** "EXCLUDE with operators that act like equality"?

09.08.2018, 22:31, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Bruce Momjian <bruce(at)momjian(dot)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

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Mark Williams 2018-08-13 17:02:39 Postgre Licence
Previous Message Bruce Momjian 2018-08-10 01:01:31 Re: Release note trimming: another modest proposal

Browse pgsql-hackers by date

  From Date Subject
Next Message 王翔宇 2018-08-10 09:50:26 Get funcid when create function
Previous Message Peter Eisentraut 2018-08-10 09:00:37 log_temp_files associated with "wrong" statement