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 1iPRWF-0002EH-Kw for pgsql-docs@arkaria.postgresql.org; Tue, 29 Oct 2019 13:26:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iPRWE-0008Bg-F4 for pgsql-docs@arkaria.postgresql.org; Tue, 29 Oct 2019 13:26:42 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPQBA-00042J-M7 for pgsql-docs@lists.postgresql.org; Tue, 29 Oct 2019 12:00:52 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPQB8-0008LE-Kk for pgsql-docs@lists.postgresql.org; Tue, 29 Oct 2019 12:00:52 +0000 Received: by mail-lj1-x243.google.com with SMTP id q64so14910277ljb.12 for ; Tue, 29 Oct 2019 05:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fGpb8/oFJbdRhJ1Kq8y5P86d41rJOsQIV529AUJN+s0=; b=Fm+UHcZBdPz8kn+4JX39NJvw7efDF7PJYPmYiiLOxeLCBPh5lbf5RkVEl7vOPZrdSl ihXFRSf5laYGPwi7sM21Fluye8K+Ysxiol8WIGcqoX6PQtJoqFnSZUM4ldceSGac8MG6 ZSun88KwOZbTuEgAdCsaZDrqaljsMt3yHhSZqbVq0Sf6YtIf0h6e3a6wUCQJUBzD+zk2 PT2SjYlXL0aHYaPoZeVJJQl3LBl7L0/GgxLY4FPAczN0hQc3yu2pzr0qabUk+6byGm58 zZ+4p3VkrOUkhsX4zbo2APUji/95yeOo0iHGv6JP1TZJLUNYr/OgMNoAv4BvAbKdgPMQ +OrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fGpb8/oFJbdRhJ1Kq8y5P86d41rJOsQIV529AUJN+s0=; b=VbtY8Kkt9MlXkUVX3pSol8toTMn0DkAXOYl83zakEwOOkT/fRLEK2guxOgj+GaY7ZJ esOaiEoq6ouSV/X8iTFDq5zyzR0KbE1657S9DF0WDc/z1TlS6pBeMRhAU6NsKiiRW0lJ +NWMPnZE5Q2RuqIjp6I6+yPY+EPFT/Xd2UzVGhhr6wS86TU0ihmTjkdlxERbwhe6Ky5e QzxVr4W9zmkAjWsA5ifHKqjC0p79uT1iIWs5e/Ga5fWfli0c3rVPBKuADp7+tU9eHtRL 4xdoZgCp1R3F+sjzj8HjZ57I/ZDBS4TJUfTynIhj6DcSNgqlmlZfMGb/REubTQi91clT ivyw== X-Gm-Message-State: APjAAAV3gkBUdEpiYYofX0NqT6G1kTrb5jf5P2KnYtkxOkKqbq+OU/gg c6ZDooIx3+atuD1+R2idU/7ickRQbrGNivWJ+UNhn0JpKN0= X-Google-Smtp-Source: APXvYqwGCYB/kGpK1gmCerkszK1xAno8zr11snyu2qD6opu/ewqdTCUmRKk2Vgwf1U2CT8kwImb914v1TtSwTwLEjpY= X-Received: by 2002:a2e:6817:: with SMTP id c23mr2371683lja.91.1572350449390; Tue, 29 Oct 2019 05:00:49 -0700 (PDT) MIME-Version: 1.0 References: <156760275564.1127.12321702656456074572@wrigleys.postgresql.org> <20190927163747.GE31412@momjian.us> <20191024143144.GE8650@momjian.us> In-Reply-To: <20191024143144.GE8650@momjian.us> From: Tuomas Leikola Date: Tue, 29 Oct 2019 14:00:38 +0200 Message-ID: Subject: Re: uniqueness and null could benefit from a hint for dba To: Bruce Momjian Cc: pgsql-docs@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000ff99af05960b5d55" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000ff99af05960b5d55 Content-Type: text/plain; charset="UTF-8" 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. -- - Tuomas --000000000000ff99af05960b5d55 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Oct 24, 2019 at 5:31 PM Bruce Mom= jian <bruce@momjian.us> wrote= :
Uh, I am wondering if it is just too details for our docs.=C2= =A0 Can you
think of some text and its location?


"Unique indexes on function= s can be used to create special types of constraints, like considering uniq= ue values equal (coalesce) or only allowing a single unique integer value o= f 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 "Wh= en an index is declared unique, multiple table rows with equal indexed valu= es are not allowed. Null values are not considered equal. A multicolumn uni= que index will only reject cases where all indexed columns are equal in mul= tiple rows.". Links to the mentioned keywords=C2=A0and concepts would = of course be helpful, but not strictly necessary.

I also thought of mention= ing the caveat of (un)scannability of function or filtered indexes but mayb= e that is a bit much.

--
- Tuomas
--000000000000ff99af05960b5d55--