Following is a list of commands that seems to work to create new user (login) and grant readonly access for one specified table on PostgreSQL.
Let's assume that these commands are executed on login with sufficient privileges (i.e. postgres
login in default install).
CREATE ROLE user_name NOSUPERUSER NOCREATEDB
NOCREATEROLE NOINHERIT LOGIN PASSWORD 'pwd' VALID UNTIL 'infinity';
Now I want to grant select
on table tab_abc
on database db_xyz
, so here it goes (database db_xyz
is selected as current via PgAdmin or something like that):
grant select on tab_abc to user_name;
The question is: is this sufficient or there should be more grants (database connect
, usage
maybe)?
These commands seem to work for me, but my default installation has default security settings. What additional grants should I add if server admin configured stronger security?
It seems that I don't need to grant connect
nor usage
- are that implicite while granting select
? Is it always so?