Обсуждение: pg_user, pg_group and arrays

Поиск
Список
Период
Сортировка

pg_user, pg_group and arrays

От
Evelio Martinez
Дата:
 
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