Re: Permissions and views. - Mailing list pgsql-general

From Tom Lane
Subject Re: Permissions and views.
Date
Msg-id 21051.989246665@sss.pgh.pa.us
Whole thread Raw
In response to Re: Permissions and views.  (Martín Marqués <martin@bugs.unl.edu.ar>)
List pgsql-general
=?iso-8859-1?q?Mart=EDn=20Marqu=E9s?= <martin@bugs.unl.edu.ar> writes:
>> It is said that RULES are executed with rule's owner permissions, so how
>> is it possible that different users are getting different results?

> This is not true. Rules are not executed with owner permission.

Yes they are.  If you do something like

    INSERT INTO view ...

which is rewritten by a rule into INSERT INTO someplace_else,
then there are two sets of permission checks applied: the original
caller must have insert rights on the view, and the rule owner must
have insert rights on "someplace_else".

In the case at hand, I'd expect that the owner of the rule issuing
SELECT...FOR UPDATE would need to have select and update permission
on the target table.

There have been sundry bugs in this mechanism in various versions of
Postgres, which is why I asked what version.  But on reading over the
thread, there's not really enough info to know whether the system
is misbehaving or not.  We'd need to see a more complete example.

            regards, tom lane

pgsql-general by date:

Previous
From: Karel Zak
Date:
Subject: Re: Autonumber
Next
From: Tom Lane
Date:
Subject: Re: views & triggers