Re: Adding UNIQUE constraint on NULL column - Mailing list pgsql-general

From Doug McNaught
Subject Re: Adding UNIQUE constraint on NULL column
Date
Msg-id 87acrdxt0f.fsf@asmodeus.mcnaught.org
Whole thread Raw
In response to Adding UNIQUE constraint on NULL column  (Dave Smith <dave.smith@candata.com>)
Responses Re: Adding UNIQUE constraint on NULL column  (Dave Smith <dave.smith@candata.com>)
List pgsql-general
Dave Smith <dave.smith@candata.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

pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: Réf. : [GENERAL] Debugging
Next
From: Dave Smith
Date:
Subject: Re: Adding UNIQUE constraint on NULL column