pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_group system table
3+ messages / 2 participants
[nested] [flat]

* pg_group system table
@ 2000-02-14 21:13  Gordon Clarke <gordonc@acenet.net.au>
  0 siblings, 0 replies; 3+ messages in thread

From: Gordon Clarke @ 2000-02-14 21:13 UTC (permalink / raw)
  To: pgsql-sql

The pgsql doco mentions that there is no create group command, at least in
v6.5.2. Further, that one needs to insert directly into the system table
pg_group which is fine. 

So I retrieved the user id's I needed from pg_user and made the following
insert.

insert into pg_group(groname, grosysid, grolist)
  values('dba',50,'{102,101,100}');

Now I want to determine which group(s) a certain user is in. So I tried.

select groname from pg_group pg
where pg.grolist{} = 101;

Which doesn't work, nor does..

select groname from pg_group pg
where pg.grolist[] = 101;

As well as many other combinations I tried. Too many to list and I'm
obviously on the wrong path.

However, provided I know where that user id is in the list ie. second, the
query works. This is not what I want because I'm not necessarily going to
know where that user id is in the list. So how do I write the query in a
general way given just the user id and not its position?

A way around is to make 3 entries for the above insert and therefore the
user id will always be the first and only item in the list, but I don't
want to have to resort to that.

Cheers...Gordon
~~~~~~~~~~~~~~ 4ZzZ Brisbane's First Community FM Station ~~~~~~~~~~~~~~
         The Demo Show - Supporting Australian Unsigned Artists
            Mon nights 6-7pm (0800-0900UTC) on 4ZzZ 102.1 FM
                  http://www.4zzzfm.org.au/zed (RA feed)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pg_group system table
@ 2000-02-22 21:36  Gordon Clarke <gordonc@acenet.net.au>
  0 siblings, 1 reply; 3+ messages in thread

From: Gordon Clarke @ 2000-02-22 21:36 UTC (permalink / raw)
  To: pgsql-sql

Sent this msg over a week ago and had no replies and as I'm in need of an
answer asap I thought I'd resubmit it.

Thanks.
----------------------------------------

The pgsql doco mentions that there is no create group command, at least in
v6.5.2. Further, that one needs to insert directly into the system table
pg_group which is fine. 

So I retrieved the user id's I needed from pg_user and made the following
insert.

insert into pg_group(groname, grosysid, grolist)
  values('dba',50,'{102,101,100}');

Now I want to determine which group(s) a certain user is in. So I tried.

select groname from pg_group pg
where pg.grolist{} = 101;

Which doesn't work, nor does..

select groname from pg_group pg
where pg.grolist[] = 101;

As well as many other combinations I tried. Too many to list and I'm
obviously on the wrong path.

However, provided I know where that user id is in the list ie. second, the
query works. This is not what I want because I'm not necessarily going to
know where that user id is in the list. So how do I write the query in a
general way given just the user id and not its position?

A way around is to make 3 entries for the above insert and therefore the
user id will always be the first and only item in the list, but I don't
want to have to resort to that.

Cheers...Gordon
~~~~~~~~~~~~~~ 4ZzZ Brisbane's First Community FM Station ~~~~~~~~~~~~~~
         The Demo Show - Supporting Australian Unsigned Artists
            Mon nights 6-7pm (0800-0900UTC) on 4ZzZ 102.1 FM
                  http://www.4zzzfm.org.au/zed (RA feed)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] pg_group system table
@ 2000-02-23 01:20  Peter Eisentraut <peter_e@gmx.net>
  parent: Gordon Clarke <gordonc@acenet.net.au>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2000-02-23 01:20 UTC (permalink / raw)
  To: Gordon Clarke <gordonc@acenet.net.au>; +Cc: pgsql-sql

On 2000-02-23, Gordon Clarke mentioned:

> Now I want to determine which group(s) a certain user is in. So I tried.

There's something in contrib/array which might help you doing a little
array walking. There's no built-in way to do it.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-02-23 01:20 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-02-14 21:13 pg_group system table Gordon Clarke <gordonc@acenet.net.au>
2000-02-22 21:36 pg_group system table Gordon Clarke <gordonc@acenet.net.au>
2000-02-23 01:20 ` Peter Eisentraut <peter_e@gmx.net>

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