From: | "Jamie Tufnell" <diesql(at)googlemail(dot)com> |
---|---|
To: | "Ray Madigan" <ray(at)madigans(dot)org> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Composite UNIQUE across two tables? |
Date: | 2008-03-07 01:10:14 |
Message-ID: | b0a4f3350803061710y2d3391cdwa54d7dcf4af5692f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi Ray,
Thanks for your reply!
On 3/6/08, Ray Madigan <ray(at)madigans(dot)org> wrote:
> I don't think I understand. You have a constraint that a user has implied
> access to any site in the group, explain why you think it would be wrong to
> have the group_id as an instance variable fro the user. Otherwise whenever
> the user is in a site in the site group other then the specific site
> represented by the user.site_id the query has to go join with the site to
> find the site group.
That's true. I'll try to explain why it feels wrong...
I already have site_id in the users table and I can determine the
site_group_id from that. So it seems redundant to me, to store
site_group_id for each user as well. Also, I'm not sure how I would
enforce that the site_group_id added to the users table would
correspond correctly with the site_id (as per the sites table).
Perhaps I would make a composite foreign key?
I've never come up against this situation before, and because of the
reasons above, I'm getting the feeling there might be a better way to
design this.
Cheers,
J.
From | Date | Subject | |
---|---|---|---|
Next Message | Jorge Godoy | 2008-03-07 02:22:27 | Re: Composite UNIQUE across two tables? |
Previous Message | Peter Eisentraut | 2008-03-06 21:14:01 | Re: query results in XML format? |