Editing PostgreSQL: CREATE ROLE

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
* <code>[[CREATE]] ROLE</code> adds a new [[role]] to a [[PostgreSQL]] database [[cluster]]. A role can be considered a [[user]], or [[group]].
+
* <code>[[CREATE ROLE]]</code> adds a new [[role]] to a [[PostgreSQL]] database [[cluster]]. A role can be considered a [[user]], or [[group]].
  
  
Line 8: Line 8:
 
  where option can be:  
 
  where option can be:  
 
   
 
   
       [[SUPERUSER]] | NOSUPERUSER
+
       SUPERUSER | NOSUPERUSER
     | [[CREATEDB]] | NOCREATEDB
+
     | CREATEDB | NOCREATEDB
 
     | CREATEROLE | NOCREATEROLE
 
     | CREATEROLE | NOCREATEROLE
 
     | CREATEUSER | NOCREATEUSER
 
     | CREATEUSER | NOCREATEUSER
Line 25: Line 25:
 
     | SYSID uid
 
     | SYSID uid
  
=== Examples ===
+
===Examples===
* <code>[[CREATE ROLE]] my_username WITH LOGIN PASSWORD 'jw8s130F4' VALID UNTIL '2022-01-01';</code>
+
* <code>CREATE ROLE my_username WITH LOGIN PASSWORD 'jw8s130F4' VALID UNTIL '2022-01-01';</code>
* <code>CREATE ROLE my_username WITH CREATEDB [[CREATEROLE]]; </code>
+
* <code>CREATE ROLE my_username WITH CREATEDB CREATEROLE; </code>
* <code>CREATE ROLE my_username [[NOLOGIN]];</code>
+
* <code>CREATE ROLE my_username NOLOGIN</code>
  
== Related ==
+
== Related commands ==
 
* <code>[[ALTER USER]]</code>
 
* <code>[[ALTER USER]]</code>
* <code>[[PostgreSQL: CREATE USER]]</code>
+
* <code>[[CREATE USER]]</code>
 
* [[PostgreSQL: Database roles]]
 
* [[PostgreSQL: Database roles]]
* <code>[[GRANT]] your_username_origin TO your_new_username_with_same_privileges;</code>
+
* <code>GRANT your_username_origin TO your_new_username_with_same_privileges;</code>
 
* <code>[[useradd]]</code>
 
* <code>[[useradd]]</code>
* [[List users]]: <code>[[\du]]</code>
+
* [[List users]]
* [[ERROR: role "your role" does not exist]]
 
* [[EOF]]
 
* [[PostgreSQL users]]
 
  
 
== See also ==
 
== See also ==
 
* {{Role}}
 
* {{Role}}
* {{CREATE}}
+
* {{SQL}}
 +
* {{PostgreSQL}}
  
 
[[Category: PosgreSQL]]
 
[[Category: PosgreSQL]]
 
[[Category: SQL]]
 
[[Category: SQL]]

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Templates used on this page:

Advertising: