Re: Adding UNIQUE constraint on NULL column

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Dave Smith <dave(dot)smith(at)candata(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Adding UNIQUE constraint on NULL column
Date: 2005-01-13 15:12:32
Message-ID: 87acrdxt0f.fsf@asmodeus.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dave Smith <dave(dot)smith(at)candata(dot)com> writes:

> I am trying to add a unique constraint on a column that can be null. The
> documentation states that null is treated as non equal values but I want
> them to be equal. Is there another way of doing this other than writing
> a before insert trigger?

UNIQUE constraints on NULLable columns work fine. It's not clear from
the above what you're looking for.

Are you really saying that you want 'NULL = NULL' to return 't'?

-Doug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dave Smith 2005-01-13 15:13:30 Re: Adding UNIQUE constraint on NULL column
Previous Message Joe Conway 2005-01-13 15:08:56 Re: Réf. : [GENERAL] Debugging