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 42CA09FB2E0 for ; Thu, 13 Jul 2006 15:44:55 -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 41342-03 for ; Thu, 13 Jul 2006 15:44:45 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from projects.commandprompt.com (host-130.commandprompt.net [207.173.203.130]) by postgresql.org (Postfix) with ESMTP id 198899FB2D5 for ; Thu, 13 Jul 2006 15:44:44 -0300 (ADT) Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net [67.76.146.141]) (authenticated bits=0) by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id k6DIimOe015563; Thu, 13 Jul 2006 11:44:48 -0700 Message-ID: <44B6949A.7070209@commandprompt.com> Date: Thu, 13 Jul 2006 11:44:42 -0700 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Thunderbird 1.5.0.4 (X11/20060615) MIME-Version: 1.0 To: Rodrigo De Leon CC: pgsql-admin@postgresql.org Subject: Re: 8.1 Unique Index Issue/Bug??? References: <1d219a6f0607130740g7fe13967t48c77a64fde977aa@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.88.2, clamav-milter version 0.88.2 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (projects.commandprompt.com [192.168.2.159]); Thu, 13 Jul 2006 11:44:48 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/99 X-Sequence-Number: 22345 >> 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." To further this... in PostgreSQL: IS NULL != '' '' is a blank string and thus an actual value where IS NULL is nothing, vapor, a blackhole. That is why IS NULL can be placed in a unique index because it isn't actually there (in the theorectical sense). Sincerely, Joshua D. Drake > > Regards, > > Rodrigo > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/