0

I'm trying to create a user with read-only permission in Postgres on AWS.

CREATE USER readonly_username WITH PASSWORD 'password';
GRANT USAGE ON SCHEMA public to readonly_username;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly_username;

After that i gave SELECT permission new tables:

ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly_username;

But when i try to give permission to existing tables i got an error:

GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly_username;

ERROR: permission denied for relation admin_log

Can anyone help me?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
tibasce
  • 133
  • 12

0 Answers0