Re: search for groups with a user

From: george young <gry(at)ll(dot)mit(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Cc: Mart?n Marqu?s <martin(at)bugs(dot)unl(dot)edu(dot)ar>
Subject: Re: search for groups with a user
Date: 2001-05-18 15:35:49
Message-ID: 20010518113549.7efb161a.gry@ll.mit.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 16 May 2001 11:49:40 +0300
Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)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]

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message tjk@tksoft.com 2001-05-18 15:53:29 Re: Calculating the age of a person
Previous Message Tom Lane 2001-05-18 15:15:12 Re: Inherited tables: How stable is that feature?