Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 4558B6344B6 for ; Mon, 18 Jan 2010 20:33:29 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 91331-02 for ; Tue, 19 Jan 2010 00:33:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mail.postgresql.org (Postfix) with SMTP id 001E46332DF for ; Mon, 18 Jan 2010 20:33:17 -0400 (AST) Received: (qmail invoked by alias); 19 Jan 2010 00:33:14 -0000 Received: from unknown (EHLO [192.168.1.113]) [88.130.207.182] by mail.gmx.net (mp058) with SMTP; 19 Jan 2010 01:33:14 +0100 X-Authenticated: #14269776 X-Provags-ID: V01U2FsdGVkX18d3PBLse8dQPTqRDnk9yCDRBBWKBw9q8exsY/yNI bSQnYcim/q6/18 Message-ID: <4B54FDF3.4070601@gmx.net> Date: Tue, 19 Jan 2010 01:33:55 +0100 From: Andreas User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: How to cascade information like the user roles ? Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.68999999999999995 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.392 tagged_above=-10 required=5 tests=AWL=-1.207, BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 201001/34 X-Sequence-Number: 33570 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