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 1fnqJE-0001c6-EQ for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Aug 2018 19:09:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fnqJC-0002ro-CH for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Aug 2018 19:09:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fnqJC-0002rc-5B for pgsql-hackers@lists.postgresql.org; Thu, 09 Aug 2018 19:09:18 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fnqJ8-0007Za-Vs for pgsql-hackers@postgresql.org; Thu, 09 Aug 2018 19:09:17 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1fnqJ7-0007Uf-10; Thu, 09 Aug 2018 15:09:13 -0400 Date: Thu, 9 Aug 2018 15:09:13 -0400 From: Bruce Momjian To: KES Cc: Tom Lane , PostgreSQL-development Subject: Re: Typo in doc or wrong EXCLUDE implementation Message-ID: <20180809190913.GB14011@momjian.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37593701533809465@sas1-87f9feb8d943.qloud-c.yandex.net> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Aug 9, 2018 at 01:11:05PM +0300, KES wrote: > Bruce: > >Yes, it would work, but doing that only for equality would be > >surprising > to many people > > 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. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +