Pavel Husakouski
Pavel Husakouski

Reputation: 145

permission denied when accessing table created by application user

I've added an R/O user:

CREATE USER ro_user WITH ENCRYPTED PASSWORD 'xxx';
GRANT CONNECT ON DATABASE my_db TO ro_user;
GRANT USAGE ON SCHEMA public TO ro_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO ro_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO ro_user;

When the table is created under the root account, the ro_name can select from these tables. However, I have an application user app_user, which also creates tables, i.e.

CREATE TABLE public.test (
    code        char(5)
)

In this case ro_name does not have the select permission. Is there a fix for that ? I need to grant select privileges on all tables in schema public regardles of who created these tables

Upvotes: 0

Views: 18

Answers (0)

Related Questions