0

I need to configure a user with an access to any views current and future without specify everytime the GRANT to the new ones.

Is it possibile?

I've searched on google but any solution user a single GRANT query like this:

CREATE VIEW chartio_read_only.”Visitors” AS SELECT * FROM Visitors; GRANT SELECT ON chartio_read_only.”Visitors” TO chartio_schema_user;

I need something more global.

EviSvil
  • 510
  • 3
  • 21
  • Look at the answer of [this post](https://stackoverflow.com/questions/69800759/what-is-the-idiomatic-way-of-having-public-and-private-functions-in-postgresql) – Edouard Nov 02 '21 at 11:00

1 Answers1

2

Use default privileges to give the user access to all future tables and views and use GRANT ... ON ALL TABLES IN SCHEMA to grant access to the existing ones.

Then put the tables into one schema and the view into another one. If you GRANT the USAGE privilege on the schema with the views, but not the schema with the tables, you have achieved your goal.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
  • Question: A user with read permission on a specific schema with views, can access view's data that is created joining table from other schemas he has no access? – EviSvil Nov 02 '21 at 14:58