Re: [GENERAL] Way to create unique constraint in Postgres even with null columns

2011-11-27 Thread David Johnston
Sunday, November 27, 2011 5:02 PM >> To: Thomas Kellerer >> Cc: pgsql-general@postgresql.org >> Subject: Re: [GENERAL] Way to create unique constraint in Postgres even with >> null columns >> >> On Sun, Nov 27, 2011 at 1:47 PM, Thomas Kellerer wrote: >>&g

Re: [GENERAL] Way to create unique constraint in Postgres even with null columns

2011-11-27 Thread Thomas Kellerer
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

Re: [GENERAL] Way to create unique constraint in Postgres even with null columns

2011-11-27 Thread Mike Christensen
Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] Way to create unique constraint in Postgres even with > null columns > > On Sun, Nov 27, 2011 at 1:47 PM, Thomas Kellerer wrote: >> Mike Christensen wrote on 27.11.2011 22:18: >>> >>> I have a tabl

Re: [GENERAL] Way to create unique constraint in Postgres even with null columns

2011-11-27 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Mike Christensen Sent: Sunday, November 27, 2011 5:02 PM To: Thomas Kellerer Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Way to create unique constraint in

Re: [GENERAL] Way to create unique constraint in Postgres even with null columns

2011-11-27 Thread Mike Christensen
On Sun, Nov 27, 2011 at 1:47 PM, Thomas Kellerer wrote: > Mike Christensen wrote on 27.11.2011 22:18: >> >> I have a table with this layout: >> >>     CREATE TABLE Favorites >>     ( >>       FavoriteId uuid NOT NULL, --Primary key >>       UserId uuid NOT NULL, >>       RecipeId uuid NOT NULL, >>

Re: [GENERAL] Way to create unique constraint in Postgres even with null columns

2011-11-27 Thread Thomas Kellerer
Mike Christensen wrote on 27.11.2011 22:18: I have a table with this layout: CREATE TABLE Favorites ( FavoriteId uuid NOT NULL, --Primary key UserId uuid NOT NULL, RecipeId uuid NOT NULL, MenuId uuid ) I want to create a unique constraint similar to th

Re: [GENERAL] Way to create unique constraint in Postgres even with null columns

2011-11-27 Thread Pavel Stehule
Hello 2011/11/27 Mike Christensen : > I have a table with this layout: > >    CREATE TABLE Favorites >    ( >      FavoriteId uuid NOT NULL, --Primary key >      UserId uuid NOT NULL, >      RecipeId uuid NOT NULL, >      MenuId uuid >    ) > > I want to create a unique constraint similar to this: