Re: creating variable views

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dado Feigenblatt <dado(at)wildbrain(dot)com>
Cc: josh(at)agliodbs(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: creating variable views
Date: 2001-07-07 19:03:44
Message-ID: 28562.994532624@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dado Feigenblatt <dado(at)wildbrain(dot)com> writes:
> One thing that still isn't clear for me is how to implement access level
> control on a per row basis.

The SQL GRANT/REVOKE stuff doesn't deal with anything finer-grain than
tables. The best way I know to cope with a need for row-level read
access control is to create a view that shows only the records you want
someone to be able to see, then grant them access to the view not the
original table.

For write access control, you have a choice of putting the controls into
the ON INSERT etc rules you make for the view, or attaching triggers to
the underlying table and checking access permissions in the triggers.
The trigger method is probably easier to deal with, but bear in mind
that such triggers will fire for everyone, including people who've been
granted direct access to the underlying table. This might or might not
be just what you want...

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-07-07 19:11:15 Re: creating variable views
Previous Message Peter Eisentraut 2001-07-07 13:35:18 Re: Is function atomic?