Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ikvc3-0006R0-So for pgsql-docs@arkaria.postgresql.org; Fri, 27 Dec 2019 19:49:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikvc2-0003Pe-Oe for pgsql-docs@arkaria.postgresql.org; Fri, 27 Dec 2019 19:49:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ikvc2-0003Bd-E1 for pgsql-docs@lists.postgresql.org; Fri, 27 Dec 2019 19:49:30 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ikvbz-0005YX-Sw for pgsql-docs@lists.postgresql.org; Fri, 27 Dec 2019 19:49:29 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1ikvbz-0005in-Bq; Fri, 27 Dec 2019 14:49:27 -0500 Date: Fri, 27 Dec 2019 14:49:27 -0500 From: Bruce Momjian To: Tuomas Leikola Cc: pgsql-docs@lists.postgresql.org Subject: Re: uniqueness and null could benefit from a hint for dba Message-ID: <20191227194927.GB16605@momjian.us> References: <156760275564.1127.12321702656456074572@wrigleys.postgresql.org> <20190927163747.GE31412@momjian.us> <20191024143144.GE8650@momjian.us> <20191105171306.GA5839@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191105171306.GA5839@momjian.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Nov 5, 2019 at 12:13:06PM -0500, Bruce Momjian wrote: > On Tue, Oct 29, 2019 at 02:00:38PM +0200, Tuomas Leikola wrote: > > On Thu, Oct 24, 2019 at 5:31 PM Bruce Momjian wrote: > > > > Uh, I am wondering if it is just too details for our docs.  Can you > > think of some text and its location? > > > > > > > > "Unique indexes on functions can be used to create special types of > > constraints, like considering unique values equal (coalesce) or only allowing a > > single unique integer value of a float column (floor). A filtered unique index > > only enforces uniqueness on the subset of rows that match the filter." > > > > I guess this would append to the paragraph "When an index is declared unique, > > multiple table rows with equal indexed values are not allowed. Null values are > > not considered equal. A multicolumn unique index will only reject cases where > > all indexed columns are equal in multiple rows.". Links to the mentioned > > keywords and concepts would of course be helpful, but not strictly necessary. > > > > I also thought of mentioning the caveat of (un)scannability of function or > > filtered indexes but maybe that is a bit much. > > I have reviewed our documentation and found approrpiate places to > mention your floor() example, and my IS NULL example. Patch attached. Patch applied back through 9.4. Thanks. -- 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 +