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; -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general