Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VSIl0-0001Ts-Qa for pgsql-sql@arkaria.postgresql.org; Sat, 05 Oct 2013 03:42:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VSIkz-0006lB-Vl for pgsql-sql@arkaria.postgresql.org; Sat, 05 Oct 2013 03:42:18 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VSIkx-0006l2-OE for pgsql-sql@postgresql.org; Sat, 05 Oct 2013 03:42:15 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VSIkm-0000MP-T5 for pgsql-sql@postgresql.org; Sat, 05 Oct 2013 03:42:14 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1VSIkl-0004Aw-Ak for pgsql-sql@postgresql.org; Fri, 04 Oct 2013 20:42:03 -0700 Date: Fri, 4 Oct 2013 20:42:03 -0700 (PDT) From: David Johnston To: pgsql-sql@postgresql.org Message-ID: <1380944523319-5773434.post@n5.nabble.com> In-Reply-To: References: <1380926286139-5773427.post@n5.nabble.com> Subject: Re: Unique index VS unique constraint MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 3.7 (+++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Steve Grey-2 wrote > Unique indexes can be partial, i.e. defined with a where clause (that must > be included in a query so that PostgreSQL knows to use that index) whereas > unique constraints cannot. This implies there can be data in the table but not in the index and thus said index is not part of the model. This strikes me, though, as a shortcoming of the declarative constraint implementation since such behavior should not modeled via indexes even if that is how they are implemented. The where clause limitation on constraints is arbitrary though adding it just for this would not pass a cost-benefit analysis. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Unique-index-VS-unique-constraint-tp5773386p5773434.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql