I want to make a typical user in postgres that will be used by my web application.
- The web application will require access to all tables.
- The user should be able to read/write to all tables (select, update, delete, insert)
All tables belong to the public schema
What is the best practise for creating this user?
database name: acmeinc user: acmeuser
I tried this so far and I was not able to even update a table (permission error on the relation):
create user acmeuser
grant all privileges on database acmeinc to acmeuser
alter schema public owner to acmeuser
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO acmeuser
Update:
I was running the above like:
psql acmeinc -c "create user acmeuser"
Should I be creating a role and then associating the user acmeuser to the role?
ERROR: permission denied for relation tableabcupdate table123 set col3='23' where id=1;Selects work fine.