0

I have script to create user and grant all privileges for table in postgres

create user dev_api with encrypted password 'xxx';
grant all privileges on database dev to dev_api;
ALTER USER dev_api CREATEDB;
GRANT ALL ON DATABASE dev TO dev_api;
GRANT ALL ON schema public TO dev_api;
GRANT ALL ON ALL TABLES IN SCHEMA public TO dev_api;

Privileges working for existing tables. Problem is that when I create new table I have not rights to read this new table.

Why?

How can I solve it in my script?

lacaci3709
  • 43
  • 1
  • 3
  • 2
    [Alter Default Priviliges](https://www.postgresql.org/docs/current/sql-alterdefaultprivileges.html) – Adrian Klaver Mar 24 '23 at 16:23
  • 1
    Does this answer your question? [Postgres. How to grant SELECT permissions automatically for new tables?](https://stackoverflow.com/questions/57892104/postgres-how-to-grant-select-permissions-automatically-for-new-tables) or [Grant permissions to user for any new tables created in postgresql](https://stackoverflow.com/q/19309416/1048572) – Bergi Mar 24 '23 at 19:44

0 Answers0