Re: Group Query

Поиск
Список
Период
Сортировка
От Rob Kirkbride
Тема Re: Group Query
Дата
Msg-id 43A016BB.6030605@rkcomputing.co.uk
обсуждение исходный текст
Ответ на Re: Group Query  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Список pgsql-jdbc
Achilleus Mantzios wrote:

>O Rob Kirkbride έγραψε στις Dec 14, 2005 :
>
>
>
>>Hi,
>>
>>It's probably because I'm struggling with array queries but how can I
>>get the (textual) list of groups allocated to the current user?
>>
>>I can get the current_user and extract the id out of pg_user, however I
>>need to then match this to an element as part of a list in pg_group,
>>this is the part I can't find how how to do. I'd like it as a ResultSet
>>with each element with the textual group name
>>
>>Thanks for any help,
>>
>>
>
>st=con.preparedStatement(select groname from pg_group where ?=any(grolist));
>st.setInt(1,uid);
>
>maybe?
>
>
Thanks thats better than my :-
select groname from pg_group where (array_to_string(grolist, 'x') ||
'x') like '%' || (select usesysid from pg_user where
usename=current_user) || 'x%'

I wasn't aware of the any operator!

Thanks a lot!

Rob


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Achilleus Mantzios
Дата:
Сообщение: Re: Group Query
Следующее
От: Thomas Frieling
Дата:
Сообщение: CallableStatements: index starts at 2