Re: mapping user name to group name - Mailing list pgsql-general

From Richard Huxton
Subject Re: mapping user name to group name
Date
Msg-id 200303110918.53002.dev@archonet.com
Whole thread Raw
In response to mapping user name to group name  (Matthew Phillips <mphillips@timing.com>)
Responses Re: mapping user name to group name  (<btober@seaworthysys.com>)
List 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

pgsql-general by date:

Previous
From: Jason Godden
Date:
Subject: Re: BLOBS (ODBC lo object) and pg_restore
Next
From: "shreedhar"
Date:
Subject: server closed the connection unexpectedly