Permission access of the table , view and function
I have a View A that will select data from view B . I only want an user ,say Peter , to have read-only access on view A but cannot select from the view B . So I grant him only have the SELECT
right on View A and REFERENCES
right on View B . It work very nice.
Now , I have a Function A that will select data from a Table B , and I want Peter can execute Function A but cannot select data from the table B. So , I do the same thing which grants 开发者_运维技巧Peter only have the EXECUTE
right on Function A and REFERENCES
right on Table B . But , it cannot work and an error message "ERROR: permission denied for relation TableB"
is thrown when peter executes Function A. How come it does not work this time?
I suspect you're looking for security definer.
As an aside, be wary of the leaky view problem. It isn't entirely fixed yet.
精彩评论