X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 5A5319FB2D0 for ; Thu, 13 Jul 2006 13:32:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 18830-07 for ; Thu, 13 Jul 2006 13:32:12 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by postgresql.org (Postfix) with ESMTP id 460F79FA31F for ; Thu, 13 Jul 2006 13:32:12 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id m2so347537uge for ; Thu, 13 Jul 2006 09:32:11 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=A51n2rszVx1pL79zor/2ylNR+GvHil+EyIzcXhktFzAas9By8b+3nmmS7q+TpYRz6etBeLWLC7GKbsrTXve8qiTcPlyVutFeSnN5vyhxHdkGOHbzMQuwaFIxOHGjZ0YQlslJD+MrgZwtVshzw+TwpunRgWenlNgSzYcFU4KS+BU= Received: by 10.67.89.5 with SMTP id r5mr237423ugl; Thu, 13 Jul 2006 09:32:11 -0700 (PDT) Received: by 10.66.234.16 with HTTP; Thu, 13 Jul 2006 09:32:10 -0700 (PDT) Message-ID: Date: Thu, 13 Jul 2006 11:32:10 -0500 From: "Rodrigo De Leon" To: pgsql-admin@postgresql.org Subject: Re: 8.1 Unique Index Issue/Bug??? In-Reply-To: <1d219a6f0607130740g7fe13967t48c77a64fde977aa@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1d219a6f0607130740g7fe13967t48c77a64fde977aa@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/98 X-Sequence-Number: 22344 On 7/13/06, Chris Hoover wrote: > On this table, I have created a unique index on payer_trn03, payer_trn04, > and expire_timestamp. However, since the expire_timestamp is normally null, > the unique index does not appear to be working. I have been able to enter > two identical rows into this table. > > Why is PostgreSQL not enforcing this index? This appears to be a pretty > major a bug? It would seem that you could have a unique index across > columns that might have a null in them. From: http://www.postgresql.org/docs/8.1/interactive/indexes-unique.html Quote: "When an index is declared unique, multiple table rows with equal indexed values will not be allowed. Null values are not considered equal. A multicolumn unique index will only reject cases where all of the indexed columns are equal in two rows." Regards, Rodrigo