alter role scott with nologin; ALTER ROLERemember that in postgres, "users" and "roles" are used interchangably, so this would also work:
alter user scott with nologin; ALTER ROLEIn either case, the postgres server will echo "ALTER ROLE" back to the administrator.
To see the result of such an operation:
echo "\du" | psqlExample output:
List of roles Role name | Attributes | Member of ---------------------------------+------------------------------------------------------------+--------------------- scott | Cannot login +| {business_users}
You can also query the postgres data dictionary for the answer, like this:
postgres=# select rolcanlogin from pg_roles where rolname='jim'; rolcanlogin ------------- t (1 row) postgres=# select rolcanlogin from pg_roles where rolname='scott'; rolcanlogin ------------- f (1 row)where t and f indicates true if the user can login and false if the user cannot, respectively.
No comments:
Post a Comment