How to cascade information like the user roles ?

From: Andreas <maps(dot)on(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to cascade information like the user roles ?
Date: 2010-01-19 00:33:55
Message-ID: 4B54FDF3.4070601@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I need something like the user-roles of PG to store options of my users.
I guess i need a table with roles, options and one that stores the
refernces from roles to options.

roles (role_id, role_name)
option (option_id, option_name)
role_has_option (role_fk, option_fk)

so far is easy. Now I can let role1 have option1 and option2 ...

But I'd further like to let role2 inherit role1's options and also have
option3.
role_inherits_role (parent_role_fk, child_role_fk)
1, 2

What SELECT would deliver all options for role2 inkluding the inherited
ones?
like
role_id, option_id
2, 1
2, 2
2, 3

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Filip Rembiałkowski 2010-01-19 14:27:39 Re: How to cascade information like the user roles ?
Previous Message Craig Ringer 2010-01-18 01:22:07 Re: indexes