X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CC1B49DC99A for ; Wed, 14 Dec 2005 08:57:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67702-08 for ; Wed, 14 Dec 2005 08:57:46 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smarthost4.mail.uk.easynet.net (smarthost4.mail.uk.easynet.net [212.135.6.14]) by postgresql.org (Postfix) with ESMTP id A05589DC81E for ; Wed, 14 Dec 2005 08:57:41 -0400 (AST) Received: from [82.111.62.66] (helo=[192.168.111.150]) by smarthost4.mail.uk.easynet.net with esmtp (Exim 4.10) id 1EmWCU-0001Nu-00; Wed, 14 Dec 2005 12:57:43 +0000 Message-ID: <43A016BB.6030605@rkcomputing.co.uk> Date: Wed, 14 Dec 2005 12:57:31 +0000 From: Rob Kirkbride User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Achilleus Mantzios CC: pgsql-jdbc@postgresql.org Subject: Re: Group Query References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-7; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/56 X-Sequence-Number: 14387 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