Re: BUG #5005: unique constraint considers nulls to be equal - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #5005: unique constraint considers nulls to be equal
Date
Msg-id 20090824005701.GH5287@alvh.no-ip.org
Whole thread Raw
In response to BUG #5005: unique constraint considers nulls to be equal  ("Dean Schulze" <dean.w.schulze@comcast.net>)
List 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

pgsql-bugs by date:

Previous
From: "Dean Schulze"
Date:
Subject: BUG #5005: unique constraint considers nulls to be equal
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #4999: select 'a' < 'A' is true, but should be false . . .