pg_user, pg_group and arrays

From: Evelio Martinez <evelio(dot)martinez(at)testanet(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_user, pg_group and arrays
Date: 2001-02-21 11:49:30
Message-ID: 3A93AB4A.7632270C@testanet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi!

I would like if there is any way to retrieve all users in a group in an
"elegant way":

Something like the following but without errors:

select usename from pg_user where usesysid in ( select grolist from
pg_group);
ERROR: Unable to identify an operator '=' for types 'int4' and '_int4'
You will have to retype this query using an explicit cast

Another way :
select usename from pg_user where usesysid in ( select grolist[1] from
pg_group where groname='tecnico')
union
select usename from pg_user where usesysid in ( select grolist[2] from
pg_group where groname='tecnico')
union
select usename from pg_user where usesysid in ( select grolist[3] from
pg_group where groname='tecnico')
union
select usename from pg_user where usesysid in ( select grolist[4] from
pg_group where groname='tecnico');

Perhaps a function in SPL ?

TIA

--
Evelio Martínez

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2001-02-21 12:55:48 Re: Weird indices
Previous Message Bruce Richardson 2001-02-21 09:35:51 Multiple triggers/rules