Difference between revisions of "PostgreSQL: Database roles"
Jump to navigation
Jump to search
(31 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | * https://www.postgresql.org/docs/current/database-roles.html | ||
− | + | Create role: | |
* <code>[[create role]]</code> | * <code>[[create role]]</code> | ||
+ | * <code>[[create user]]</code> | ||
+ | * <code>[[PostgreSQL: CREATE USER|CREATE USER]] name WITH Role XXX</code> | ||
+ | List [[users]] and roles: | ||
+ | * <code>[[\du]]</code> | ||
+ | * <code>[[\du+]]</code> | ||
* <code>[[SELECT rolname FROM pg_roles;]]</code> | * <code>[[SELECT rolname FROM pg_roles;]]</code> | ||
+ | * <code>[[SELECT * FROM pg_roles]];</code> | ||
+ | |||
+ | Assign roles: | ||
+ | * <code>[[GRANT "your-defined role" TO "your username";]]</code> | ||
== Related terms == | == Related terms == | ||
− | * <code>[[\ | + | * <code>[[CREATE ROLE]]</code>, <code>[[create user]]</code> |
− | + | * [[Schema]] | |
+ | * <code>[[GRANT]]</code> privileges to [[roles]] | ||
+ | * <code>[[Superuser]]</code> | ||
+ | * <code>[[rds_superuser]]</code> role in [[AWS RDS]] | ||
+ | * [[Ansible roles]] | ||
+ | * [[ALTER USER myuser WITH SUPERUSER;]] | ||
+ | * [[DROP ROLE]] | ||
+ | * [[community.postgresql.postgresql_privs]] | ||
+ | * <code>[[\list+]]</code> | ||
== See also == | == See also == | ||
− | * {{PostgreSQL}} | + | * {{Role}} |
+ | * {{GRANT}} | ||
+ | * {{PostgreSQL Privileges}} | ||
[[Category:PostgreSQL]] | [[Category:PostgreSQL]] |
Latest revision as of 12:07, 16 December 2022
Create role:
CREATE USER name WITH Role XXX
List users and roles:
Assign roles:
Related terms[edit]
CREATE ROLE
,create user
- Schema
GRANT
privileges to rolesSuperuser
rds_superuser
role in AWS RDS- Ansible roles
- ALTER USER myuser WITH SUPERUSER;
- DROP ROLE
- community.postgresql.postgresql_privs
\list+
See also[edit]
- PostgreSQL: Database roles,
CREATE USER
,CREATE ROLE
,\du, \du+
,create user, Alter user
GRANT
,\ddp
,GRANT USAGE
,GRANT ALL PRIVILEGES
,GRANT SELECT
, View GRANTs on Redshift,has_table_privilege
,has_schema_privilege
,HAS_DATABASE_PRIVILEGE
,SCHEMA
, Privileges,GRANT EXECUTE
- PostgreSQL Privileges, GRANT,
\list+, \du+
Advertising: