looking up members of a group
От | Michiel Lange |
---|---|
Тема | looking up members of a group |
Дата | |
Msg-id | 5.1.0.14.0.20030313080139.027a4cf0@192.168.1.3 обсуждение исходный текст |
Ответы |
Re: looking up members of a group
|
Список | pgsql-novice |
Hi all, I am looking for a way to determine wether or not a user is a member of a group... if I do: SELECT * FROM pg_group; I get something like this: groname | grosysid | grolist ----------+----------+----------------------- users | 103 | {100,102} admins | 101 | {103,1} guests | 100 | {101} customer | 102 | {104,105,106,107,108} that's pretty ok, and it appears that the members of the group are in an array... arrays in a database... it's always been a blast to me, always having trouble working with them, so I don't use arrays often... but here I must *grin* Anyway... I want to know if a user 'john' is member of 'admins', to determine wether or not to show an administrative button on the website. I was thinking of creating a function in PL/SQL, but I still have not the hang of that... but it would be nice to do a: SELECT * FROM is_member(john,admin); where it would return a boolean saying yes or no... or SELECT * FROM is_member(john); where it would return a column with all the groups john is member of... maybe someone can help me out? TIA, Michiel
В списке pgsql-novice по дате отправления: