Re: BUG #5005: unique constraint considers nulls to be equal

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Dean Schulze <dean(dot)w(dot)schulze(at)comcast(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5005: unique constraint considers nulls to be equal
Date: 2009-08-24 00:57:01
Message-ID: 20090824005701.GH5287@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Dean Schulze wrote:

> Here are the duplicate records that violate this constraint:
>
> select county, year, idnumber, count(0) from table1 group by county, year,
> idnumber having (count(0) > 1) order by county, count(0);
>
>
> "county","year","idnumber","count"
> "AD",2009,"A57504",2
> "AD",2009,"A58395",2
> "AD",2009,"A58286",2
> "AD",2009,"A58299",2
> "AD",2009,"",5

What you have here seems to be an empty string, which is not the same as
a NULL value. True NULLs behave as expected.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2009-08-24 08:53:37 Re: BUG #4999: select 'a' < 'A' is true, but should be false . . .
Previous Message Dean Schulze 2009-08-23 22:59:49 BUG #5005: unique constraint considers nulls to be equal