Re: mapping user name to group name

From: Richard Huxton <dev(at)archonet(dot)com>
To: Matthew Phillips <mphillips(at)timing(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: mapping user name to group name
Date: 2003-03-11 09:18:52
Message-ID: 200303110918.53002.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 10 Mar 2003 5:47 pm, Matthew Phillips wrote:
> Hey guys... first time caller, long time listener.
>
> Don't ask me why, but I would like a quick way to map a user name to the
> group name that the user is part of. Using pg_user and pg_group makes
> this a little tricky. You can obtain usesysid from pg_user, and then get
> the groname from pg_group based on it. However each group has its own
> usesysids within an array of integers. I have no clue how to search
> within an array using a select statement.

By default - you don't.

> Am I making it harder than it should be? Is there a sys table already
> out there that is doing this mapping for me? How do I do this (with
> minimal hastle)

Nope - PG is making it harder than it should be. Having said that there are
some array-handling functions in contrib/intarray (sorry - don't know what,
never used them).

Also, I'm sure this must have been dealt with before. I'd recommend checking
techdocs.postgresql.org and especially Roberto's plpgsql cookbook. If that
comes up with nothing, it shouldn't be too difficult to write a small plpgsql
function to do what you want. If you're not familiar with plpgsql get back to
me and I'll run something up for you.

--
Richard Huxton

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message shreedhar 2003-03-11 09:23:50 server closed the connection unexpectedly
Previous Message Jason Godden 2003-03-11 09:05:54 Re: BLOBS (ODBC lo object) and pg_restore