Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fo3Rl-00013W-EU for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Aug 2018 09:11:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fo3Rk-0005iu-0v for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Aug 2018 09:11:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fo3Rj-0005il-KL for pgsql-hackers@lists.postgresql.org; Fri, 10 Aug 2018 09:10:59 +0000 Received: from forward2o.cmail.yandex.net ([2a02:6b8:0:1a72::287]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fo3Re-0002aY-4l for pgsql-hackers@postgresql.org; Fri, 10 Aug 2018 09:10:58 +0000 Received: from mxback1j.mail.yandex.net (mxback1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10a]) by forward2o.cmail.yandex.net (Yandex) with ESMTP id 4D92621365; Fri, 10 Aug 2018 12:10:48 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id y9MLibhuVN-Alwue8KK; Fri, 10 Aug 2018 12:10:47 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1533892247; bh=OWYah97MBWEPyKE1shBELMrJZNNLLv5Fk0CHTQ0Dvgw=; h=From:To:Cc:In-Reply-To:References:Subject:Date:Message-Id; b=MqYV9n8iGkWtXmxURSfhTaH6Y6vNolvkx++J/e01fin7oGtJPQd7/hDE+zFgqYnVg bA2OYT36y++U/r9mP68hNQEr/H1LayQ2XJtS/BWR1uIJD+iYGb1HQS9lkn1E/mnKfV sK8GishwXoPsF5Q/IF9ZTO2fJo/aT9eLVOk/woVc= Authentication-Results: mxback1j.mail.yandex.net; dkim=pass header.i=@yandex.ru Received: by sas1-ea1d14049a51.qloud-c.yandex.net with HTTP; Fri, 10 Aug 2018 12:10:47 +0300 From: KES Envelope-From: kes-kes@yandex.com To: Tom Lane , Bruce Momjian Cc: PostgreSQL-development In-Reply-To: <25606.1533843069@sss.pgh.pa.us> References: <153121527691.1408.5686988620817799073@wrigleys.postgresql.org> <20180807173659.GD7297@momjian.us> <31616681533725753@sas1-d856b3d759c7.qloud-c.yandex.net> <20180808130040.GA2611@momjian.us> <12107.1533736288@sss.pgh.pa.us> <37593701533809465@sas1-87f9feb8d943.qloud-c.yandex.net> <20180809190913.GB14011@momjian.us> <25606.1533843069@sss.pgh.pa.us> Subject: Re: Typo in doc or wrong EXCLUDE implementation MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Fri, 10 Aug 2018 12:10:47 +0300 Message-Id: <43021481533892247@sas1-ea1d14049a51.qloud-c.yandex.net> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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" : > Bruce Momjian 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