Re: Why an array in pg_group?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reinoud van Leeuwen <reinoud(at)xs4all(dot)nl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why an array in pg_group?
Date: 2002-11-21 15:41:52
Message-ID: 12085.1037893312@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Reinoud van Leeuwen <reinoud(at)xs4all(dot)nl> writes:
> Is there any reason why the grolist field in the table pg_group is
> implemented as an array and not as a separate table?

It's easier to cache a single entry per group in the GRONAME and GROSYSID
syscaches than a bunch of them. The design is optimized for the
needs of the system's internal permissions-checking code, not for
the convenience of people trying to interrogate pg_group in SQL.

> I have trouble implementing a way to easily check whether a user is part
> of a group.

Perhaps you could create a table that has no purpose except to be a
permissions-check target, and set it up to have permissions granted only
to the group you care about. Then use has_table_privilege().

In the long run I'd have no objection to adding an is_group_member()
function (need a better choice of name, perhaps) to cater to this sort
of request. Too late for 7.3 though.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Wheeler 2002-11-21 16:13:52 Re: DBD::PostgreSQL
Previous Message Reinoud van Leeuwen 2002-11-21 13:28:35 Why an array in pg_group?