Yet another request came to me today for granting SELECT permissions. This time, the request was to give the user the correct privileges to use a view. Basically, you can use the same format that is used for tables as is used for views:
SELECT 'GRANT SELECT ON ' || quote_ident(schemaname) || '.' || quote_ident(viewname) || ' TO john_doe;' FROM pg_views WHERE schemaname = 'public';
After running a query like this one, you will be given all of the GRANT statements needed to give SELECT permissions to all of the views in the public schema.








