pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Group Query
3+ messages / 2 participants
[nested] [flat]

* Group Query
@ 2005-12-14 11:00  Rob Kirkbride <rob@rkcomputing.co.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Rob Kirkbride @ 2005-12-14 11:00 UTC (permalink / raw)
  To: pgsql-jdbc

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,

Rob




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Group Query
@ 2005-12-14 12:57  Rob Kirkbride <rob@rkcomputing.co.uk>
  parent: Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Rob Kirkbride @ 2005-12-14 12:57 UTC (permalink / raw)
  To: Achilleus Mantzios <achill@matrix.gatewaynet.com>; +Cc: 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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Group Query
@ 2005-12-14 13:43  Achilleus Mantzios <achill@matrix.gatewaynet.com>
  parent: Rob Kirkbride <rob@rkcomputing.co.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Achilleus Mantzios @ 2005-12-14 13:43 UTC (permalink / raw)
  To: Rob Kirkbride <rob@rkcomputing.co.uk>; +Cc: pgsql-jdbc

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?
> 
> Rob
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
> 

-- 
-Achilleus




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-12-14 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-12-14 11:00 Group Query Rob Kirkbride <rob@rkcomputing.co.uk>
2005-12-14 13:43 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2005-12-14 12:57   ` Rob Kirkbride <rob@rkcomputing.co.uk>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox