pg_user, pg_group and arrays - Mailing list pgsql-general

From Evelio Martinez
Subject pg_user, pg_group and arrays
Date
Msg-id 3A93AB4A.7632270C@testanet.com
Whole thread Raw
List 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
 

pgsql-general by date:

Previous
From: brichard@cafod.org.uk (Bruce Richardson)
Date:
Subject: Multiple triggers/rules
Next
From: "Neil Burrows"
Date:
Subject: Inheritance Question