Re: enforcing with unique indexes.. - Mailing list pgsql-sql

From
Subject Re: enforcing with unique indexes..
Date
Msg-id 49201.192.168.1.32.1033827192.squirrel@mainbox.archonet.com
Whole thread Raw
In response to enforcing with unique indexes..  ("Rajesh Kumar Mallah." <mallah@trade-india.com>)
List pgsql-sql
>
> ie i want 1 to 1 mapping between group_id and userid so that , there
> shud not be a  single group_id having more that one kind of userid.
>
> can it be done with some sort of UNIQUE INDEX?

If you want multiple groups but the user should always be the same

1  1  ok
1  1  ok
2  1  ok
3  2  ok
3  3  bad

Perhaps you should normalise a bit further with a separate group_user
table - you could restrict that to being unique on group then.

- Richard Huxton




pgsql-sql by date:

Previous
From: "Rajesh Kumar Mallah."
Date:
Subject: Re: enforcing with unique indexes..
Next
From: pete@phillipsfamily.freeserve.co.uk
Date:
Subject: problem with subqueries