I am having a behaviour I cannot understand, and I have no idea where to look for solutions.

I have a view called wms_view_orderline that gets information from the wms_orderline table. When I SELECT from the wms_orderline table, I get information. But when I use the view, I get this error:

bf=# select * from wms_view_orderline ;
ERROR:  permission denied for table wms_orderline

My user is superuser (even postgres gets this error), and has all permissions on the table and view granted.

Update when I recreated the exact same view with another name, it works.

  • Is the other view created under a different account? Does it have the same schema owner as the tables? That might be the issue. Oct 20, 2021 at 11:26

1 Answer 1


When you select from a view, it runs as the user who created the view. Apparently this view was created by a user who did not have access (or later lost access) to the underlying table.

Why would someone do that? No idea. The permissions system is flexible and let you do all sorts of wonderful things, but also all sorts of nonsense.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.