Thread: updateble views

updateble views

From
thiemo
Date:
Hi,


I have a table that I want users to access to only through a view. For
the inserts, I have defined a rule.  I granted insert rights on the
base table and view as well as select rights on the view to the users.
However, a users trying an insert on the view gets an "Error while
executing statement: ERROR:  s_pwd.nextval: you don't have permissions
to set sequence s_pwd". Is there a right I need to grant to the users
regarding the sequence?


Thx


Thiemo

<fontfamily><param>Helvetica</param>

--

Thiemo Kellner

Tösstalstrasse 146

CH-8400 Winterthur

</fontfamily>Hi,

I have a table that I want users to access to only through a view. For
the inserts, I have defined a rule.  I granted insert rights on the base
table and view as well as select rights on the view to the users.
However, a users trying an insert on the view gets an "Error while
executing statement: ERROR:  s_pwd.nextval: you don't have permissions
to set sequence s_pwd". Is there a right I need to grant to the users
regarding the sequence?

Thx

Thiemo

--
Thiemo Kellner
Tösstalstrasse 146
CH-8400 Winterthur

Re: updateble views

From
"Josh Berkus"
Date:
Thiemo,

> I have a table that I want users to access to only through a view.
> For the inserts, I have defined a rule.  I granted insert rights on
> the base table and view as well as select rights on the view to the
> users. However, a users trying an insert on the view gets an "Error
> while executing statement: ERROR:  s_pwd.nextval: you don't have
> permissions to set sequence s_pwd". Is there a right I need to grant
> to the users regarding the sequence?

Yes.
GRANT SELECT, UPDATE ON <sequence_name> TO <user>;

-Josh Berkus

Re: updateble views

From
Tom Lane
Date:
thiemo <thiemo@gmx.ch> writes:
> I have a table that I want users to access to only through a view. For=20
> the inserts, I have defined a rule.  I granted insert rights on the base=20
> table and view as well as select rights on the view to the users.=20
> However, a users trying an insert on the view gets an "Error while=20
> executing statement: ERROR:  s_pwd.nextval: you don't have permissions=20
> to set sequence s_pwd". Is there a right I need to grant to the users=20
> regarding the sequence?

Unfortunately, you'll have to give 'em update rights on the sequence.

This should be checked against the rule owner's permissions, not the
rule user's permissions, but nextval() has no idea it's being executed
as the result of rule expansion rather than something the user typed
directly :-(

            regards, tom lane