Postgresql grant user privilages to dynamically created tables

crudpermissionspostgresql

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;

Best Answer

Set your default privileges for the schema using ALTER DEFAULT PRIVILEGES