pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: george young <gry@ll.mit.edu>
To: pgsql-sql@postgresql.org
Cc: Mart?n Marqu?s <martin@bugs.unl.edu.ar>
Subject: Re: search for groups with a user
Date: Fri, 18 May 2001 11:35:49 -0400
Message-ID: <20010518113549.7efb161a.gry@ll.mit.edu> (raw)
In-Reply-To: <0105161149400B.29608@bugs>
References: <0105161149400B.29608@bugs>

On Wed, 16 May 2001 11:49:40 +0300
Martín Marqués <martin@bugs.unl.edu.ar> wrote:
> I have to search for which groups a certain user is in. I found out that the 
> field grolist is of type INT[] (array of integers with reference to the 
> uids). To search through the array I need a module which is in contrib/array, 
> which I found, but how do I use it? What do I have to do to be able to do 
> searches on arrays in the WHERE clause?
In postgresq-7.0.3, I did:

cd contrib/array
make
make install

[I'm not certain the following is necessary, but if you get errors it might fix things]
psql -d yourdb -f array_iterator.sql
[or whereever install put it]


Then, just try something like:
 
select groname from pg_group g, pg_user u
	where g.grolist *= u.usesysid and 
	      u.usename = 'young' ;
  groname   
------------
 supervisor
 originator
 operator
(3 rows)

showing that I'm in those three groups.


I hope this helps,
	-- George

-- 
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now?  [OK]



view thread (3+ messages)

Message-ID: <20010518113549.7efb161a.gry@ll.mit.edu>
Permalink:  ../20010518113549.7efb161a.gry@ll.mit.edu/
Also on:    postgresql.org/message-id/20010518113549.7efb161a.gry@ll.mit.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: gry@ll.mit.edu, martin@bugs.unl.edu.ar
  Subject: Re: search for groups with a user
  In-Reply-To: <20010518113549.7efb161a.gry@ll.mit.edu>
  References: <0105161149400B.29608@bugs> <20010518113549.7efb161a.gry@ll.mit.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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