PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 20th, 2009, 04:38 AM
prakashgula prakashgula is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 2 prakashgula User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 51 sec
Reputation Power: 0
Role Hierarchy

Hi,
I am using PostgreSQL 8.1 . I am trying to print all the roles in a hierarchy. For example

r1
|
r2 r3
| |
-------
|
r4
|
r5

Here r5 is member of r4 , r4 is member of r2 and r3 and r2 is member of r1. Now in a query if i give role name as 'r5' it has to display the entire hierarchy. For this I am trying with the following query but it just printing the immediate hierarchy only.
The query is as following :

select pr.rolname from pg_roles pr
LEFT JOIN pg_auth_members pam
ON(pr.oid=pam.roleid)
LEFT JOIN pg_roles pr1
ON (pam.member=pr1.oid)
WHERE pr1.rolname='r4';

I need a solution for this problem.

Regards,
Prakash.

Reply With Quote
  #2  
Old September 20th, 2012, 01:23 PM
metaltree metaltree is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2008
Location: Québec city
Posts: 13 metaltree User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 11 m 10 sec
Reputation Power: 0
Hi Prakash, did you ever find the solution for that ?

I'm having the same problem to solve, so I'd be interested to know the answer.

Thanks,

Sebastien


Quote:
Originally Posted by prakashgula
Hi,
I am using PostgreSQL 8.1 . I am trying to print all the roles in a hierarchy. For example

r1
|
r2 r3
| |
-------
|
r4
|
r5

Here r5 is member of r4 , r4 is member of r2 and r3 and r2 is member of r1. Now in a query if i give role name as 'r5' it has to display the entire hierarchy. For this I am trying with the following query but it just printing the immediate hierarchy only.
The query is as following :

select pr.rolname from pg_roles pr
LEFT JOIN pg_auth_members pam
ON(pr.oid=pam.roleid)
LEFT JOIN pg_roles pr1
ON (pam.member=pr1.oid)
WHERE pr1.rolname='r4';

I need a solution for this problem.

Regards,
Prakash.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > Role Hierarchy

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap