0

We have 2 postgresql users. One user (dbworkeruser) for creating tables dynamically (from C# worker) and other user (injestworkeruser) for inserting data into these tables (from another C# worker as well). The main issue that we have is that, every time we do drop/create new tables dynamically (on runtime) we get exception that the user injestworkeruser doesn't have enough permission to select or insert data from/into these newly created tables. This is the created user:

CREATE USER injestworkeruser WITH
  LOGIN
  NOSUPERUSER
  INHERIT
  NOCREATEDB
  NOCREATEROLE
  NOREPLICATION;

Is there anyway to grant the user permissions to apply CRUD operations to any newely created table?

This one didn't work for me as this applies to the existing tables:

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO injestworkeruser;
1

2 Answers 2

1

Set your default privileges for the schema using ALTER DEFAULT PRIVILEGES

-1

GRANT usage ON SCHEMA createuser TO consume;

alter default privileges for user createuser in schema createuser grant select on tables to consume;

This will work perfect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.