Re: Composite UNIQUE across two tables?

Поиск
Список
Период
Сортировка
От Jamie Tufnell
Тема Re: Composite UNIQUE across two tables?
Дата
Msg-id b0a4f3350803061710y2d3391cdwa54d7dcf4af5692f@mail.gmail.com
обсуждение исходный текст
Ответ на Composite UNIQUE across two tables?  ("Jamie Tufnell" <diesql@googlemail.com>)
Ответы Re: Composite UNIQUE across two tables?
Список pgsql-sql
Hi Ray,

Thanks for your reply!

On 3/6/08, Ray Madigan <ray@madigans.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.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: query results in XML format?
Следующее
От: Jorge Godoy
Дата:
Сообщение: Re: Composite UNIQUE across two tables?