3
PostgreSQL documentation
6
<refentry id="SQL-CREATEUSER">
8
<refentrytitle id="sql-createuser-title">CREATE USER</refentrytitle>
9
<manvolnum>7</manvolnum>
10
<refmiscinfo>SQL - Language Statements</refmiscinfo>
14
<refname>CREATE USER</refname>
15
<refpurpose>define a new database role</refpurpose>
18
<indexterm zone="sql-createuser">
19
<primary>CREATE USER</primary>
24
CREATE USER <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
26
where <replaceable class="PARAMETER">option</replaceable> can be:
28
SUPERUSER | NOSUPERUSER
29
| CREATEDB | NOCREATEDB
30
| CREATEROLE | NOCREATEROLE
31
| CREATEUSER | NOCREATEUSER
34
| CONNECTION LIMIT <replaceable class="PARAMETER">connlimit</replaceable>
35
| [ ENCRYPTED | UNENCRYPTED ] PASSWORD '<replaceable class="PARAMETER">password</replaceable>'
36
| VALID UNTIL '<replaceable class="PARAMETER">timestamp</replaceable>'
37
| IN ROLE <replaceable class="PARAMETER">rolename</replaceable> [, ...]
38
| IN GROUP <replaceable class="PARAMETER">rolename</replaceable> [, ...]
39
| ROLE <replaceable class="PARAMETER">rolename</replaceable> [, ...]
40
| ADMIN <replaceable class="PARAMETER">rolename</replaceable> [, ...]
41
| USER <replaceable class="PARAMETER">rolename</replaceable> [, ...]
42
| SYSID <replaceable class="PARAMETER">uid</replaceable>
47
<title>Description</title>
50
<command>CREATE USER</command> is now an alias for
51
<xref linkend="sql-createrole" endterm="sql-createrole-title">.
52
The only difference is that when the command is spelled
53
<command>CREATE USER</command>, <literal>LOGIN</> is assumed
54
by default, whereas <literal>NOLOGIN</> is assumed when
55
the command is spelled
56
<command>CREATE ROLE</command>.
61
<title>Compatibility</title>
64
The <command>CREATE USER</command> statement is a
65
<productname>PostgreSQL</productname> extension. The SQL standard
66
leaves the definition of users to the implementation.
71
<title>See Also</title>
73
<simplelist type="inline">
74
<member><xref linkend="sql-createrole" endterm="sql-createrole-title"></member>