postgresql - Creating a postgres user -


i want make typical user in postgres used web application.

  1. the web application require access tables.
  2. 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

Popular posts from this blog

How do you convert a timestamp into a datetime in python with the correct timezone? -

how to display 2 form fields on same line with bootstrap -

c# - how to use buttonedit in devexpress gridcontrol -