Re: Way to create unique constraint in Postgres even with null columns - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: Way to create unique constraint in Postgres even with null columns
Date
Msg-id jaufbt$nga$1@dough.gmane.org
Whole thread Raw
In response to Re: Way to create unique constraint in Postgres even with null columns  ("David Johnston" <polobo@yahoo.com>)
List pgsql-general
David Johnston wrote on 27.11.2011 23:18:

> Also, the index example above presumes you want RecipeId to be "Null-able"
> as opposed to MenuId as described in your original post.
>

Well of course that was a typo in my answer, it should have been:

CREATE UNIQUE INDEX Favorites_UniqueFavorite
     ON (UserId, RecipeId)
     WHERE MenuId IS NULL;


pgsql-general by date:

Previous
From: Mike Christensen
Date:
Subject: Re: Way to create unique constraint in Postgres even with null columns
Next
From: David Johnston
Date:
Subject: Re: Way to create unique constraint in Postgres even with null columns