Kay
Kay

Reputation: 195

Postgres - grant permission to an existing user in a role group

I am trying to grant permissions to a user within a role group, where are the steps that I did:

  1. create the user: myuser
  2. create the role group: read_only
  3. grant read_only to myuser
  4. grant select on all tables in schema public to read_only
  5. alter default priviliges in schema public grant select on tables to read_only

after all the steps above, when I use myuser to query the tables, I got 'permission denied'. Anything I missed here?

Upvotes: 1

Views: 1573

Answers (1)

gsteiner
gsteiner

Reputation: 776

Altering default privileges only affects new tables. You will want to grant the privileges on all existing tables by issuing the below in order for you to have permissions.

GRANT SELECT ON ALL TABLES IN SCHEMA public TO read_only;

Upvotes: 1

Related Questions