postgresql - Creating a postgres user -
i want make typical user in postgres used web application.
- the web application require access tables.
- the user should able read/write tables (select, update, delete, insert)
all tables belong public schema
what best practise creating user?
database name: acmeinc user: acmeuser
i tried far , not able update table (permission error on relation):
create user acmeuser grant privileges on database acmeinc acmeuser alter schema public owner acmeuser alter default privileges in schema public grant select, insert, update, delete on tables acmeuser
update:
i running above like:
psql acmeinc -c "create user acmeuser"
should creating role , associating user acmeuser role?
i think issue stems 2 misunderstandings around grant
:
granting on database doesn't grant on tables within it, grants rights on database object self; and
alter default privileges
affects tables created after run, doesn't change existing tables.
you want grant ... on tables in schema ...
.
Comments
Post a Comment