Thread: Views permision -- please help and suggestion

Views permision -- please help and suggestion

From
salah jubeh
Date:
I have two views A and B such that A depend on B. Both of them has the same permissions. 

when I excute

SELECT * FROM  A;

ERROR:  permission denied for relation B

********** Error **********

ERROR: permission denied for relation B
SQL state: 42501


However, I can do

SELECT * FROM  B;

How can I trace this problem, It really confuses me.

Regards

Re: Views permision -- please help and suggestion

From
Adrian Klaver
Date:
On Tuesday, May 24, 2011 6:50:38 am salah jubeh wrote:
> I have two views A and B such that A depend on B. Both of them has the same
> permissions.

What are the permissions?

>
>
> when I excute
>
> SELECT * FROM  A;

Who are you executing the above as?

>
> ERROR:  permission denied for relation B
>
> ********** Error **********
>
> ERROR: permission denied for relation B
> SQL state: 42501
>
>
> However, I can do
>
> SELECT * FROM  B;
>
> How can I trace this problem, It really confuses me.

As was mentioned earlier the issue is in the relationship between A and B. As a
user you may have permission to both A and B and can access either. The A view
though may have  permissions that do not allow it to access B. As was pointed
out the ability of A to select from B is dependent on As permissions, not the
the user initiating the select.

>
> Regards

--
Adrian Klaver
adrian.klaver@gmail.com

Re: Views permision -- please help and suggestion

From
salah jubeh
Date:
Hello Adrian,

I have changed the permission of one table where view B depend on and my problem is over. Still; the whole issue is confusing me.
 
Regards


From: Adrian Klaver <adrian.klaver@gmail.com>
To: pgsql-general@postgresql.org
Cc: salah jubeh <s_jubeh@yahoo.com>
Sent: Tue, May 24, 2011 4:13:38 PM
Subject: Re: [GENERAL] Views permision -- please help and suggestion

On Tuesday, May 24, 2011 6:50:38 am salah jubeh wrote:
> I have two views A and B such that A depend on B. Both of them has the same
> permissions.

What are the permissions?

>
>
> when I excute
>
> SELECT * FROM  A;

Who are you executing the above as?

>
> ERROR:  permission denied for relation B
>
> ********** Error **********
>
> ERROR: permission denied for relation B
> SQL state: 42501
>
>
> However, I can do
>
> SELECT * FROM  B;
>
> How can I trace this problem, It really confuses me.

As was mentioned earlier the issue is in the relationship between A and B. As a
user you may have permission to both A and B and can access either. The A view
though may have  permissions that do not allow it to access B. As was pointed
out the ability of A to select from B is dependent on As permissions, not the
the user initiating the select.

>
> Regards

--
Adrian Klaver
adrian.klaver@gmail.com

Re: Views permision -- please help and suggestion

From
Adrian Klaver
Date:
On 05/24/2011 10:04 AM, salah jubeh wrote:
> Hello Adrian,
>
> I have changed the permission of one table where view B depend on and my
> problem is over. Still; the whole issue is confusing me.

See here for explanation:
http://www.postgresql.org/docs/9.0/interactive/sql-createview.html
"Access to tables referenced in the view is determined by permissions of
the view owner. In some cases, this can be used to provide secure but
restricted access to the underlying tables. However, not all views are
secure against tampering; see Section 37.4 for details. Functions called
in the view are treated the same as if they had been called directly
from the query using the view. Therefore the user of a view must have
permissions to call all functions used by the view. "

And in turn:

http://www.postgresql.org/docs/9.0/interactive/rules-privileges.html

>
> Regards
>


--
Adrian Klaver
adrian.klaver@gmail.com