Обсуждение: is there a way to find out if an element is exist in an array

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

is there a way to find out if an element is exist in an array

От
b t
Дата:
As part of my project, we have to build a tool similar to phppgadmin, I want to find out if a particular is in what group, I used "select grolist from pg_group where groname = 'webmaster';" it returned an array of user in group "webmaster" I want to find out if a particular user is in that array.
Thanks in advance
-Brian
 


Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web

Re: is there a way to find out if an element is exist

От
Joe Conway
Дата:
b t wrote:
> As part of my project, we have to build a tool similar to phppgadmin,
> I want to find out if a particular is in what group, I used "select
> grolist from pg_group where groname = 'webmaster';" it returned an
> array of user in group "webmaster" I want to find out if a particular
> user is in that array. Thanks in advance

Something like this? (in Postgres 8.0.x)

select usename from pg_user, pg_group
where usesysid = any (grolist) and groname = 'webmaster';

HTH,

Joe