Re: Permission on insert rules

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Luis Sousa <llsousa(at)ualg(dot)pt>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Permission on insert rules
Date: 2002-11-11 20:12:59
Message-ID: 200211111212.59912.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Luis,

> Just a question.
> I'm writing some rules to insert/update some data in my database, and I
> gave all the privileges on that view to the user, and only select on the
> tables.
> When that user inserts data using the view, I thought that was user
> postgres that will do the rest ! But I got permission denied on those
> tables.
> The idea was to create a layer, with the views, giving to that user
> permission on views to insert and update, and not to tables.
> Is this possible ?

I just checked this. It works fine in 7.2.3.

I think that you are missing a step. If you want to have an updatable view,
then you need to define a Rule for updating it, such as:

kitchen=# create rule update_password as on update to user_password
kitchen-# do instead update "user" set "password" = NEW."password"
kitchen-# where user_id = OLD.user_id;

See the online docs, under Server Programming, for how to use the RULES
system.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Martin Crundall 2002-11-12 05:15:53 pg_dump / dates:
Previous Message Peter Eisentraut 2002-11-11 20:12:37 Re: bigger problem