summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/ref/create_user.sgml
blob: 48d2089238c7ff0edf79013f591e2e5825b88a93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!--
doc/src/sgml/ref/create_user.sgml
PostgreSQL documentation
-->

<refentry id="sql-createuser">
 <indexterm zone="sql-createuser">
  <primary>CREATE USER</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>CREATE USER</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>CREATE USER</refname>
  <refpurpose>define a new database role</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
<synopsis>
CREATE USER <replaceable class="parameter">name</replaceable> [ [ WITH ] <replaceable class="parameter">option</replaceable> [ ... ] ]

<phrase>where <replaceable class="parameter">option</replaceable> can be:</phrase>

      SUPERUSER | NOSUPERUSER
    | CREATEDB | NOCREATEDB
    | CREATEROLE | NOCREATEROLE
    | INHERIT | NOINHERIT
    | LOGIN | NOLOGIN
    | REPLICATION | NOREPLICATION
    | BYPASSRLS | NOBYPASSRLS
    | CONNECTION LIMIT <replaceable class="parameter">connlimit</replaceable>
    | [ ENCRYPTED ] PASSWORD '<replaceable class="parameter">password</replaceable>' | PASSWORD NULL
    | VALID UNTIL '<replaceable class="parameter">timestamp</replaceable>'
    | IN ROLE <replaceable class="parameter">role_name</replaceable> [, ...]
    | IN GROUP <replaceable class="parameter">role_name</replaceable> [, ...]
    | ROLE <replaceable class="parameter">role_name</replaceable> [, ...]
    | ADMIN <replaceable class="parameter">role_name</replaceable> [, ...]
    | USER <replaceable class="parameter">role_name</replaceable> [, ...]
    | SYSID <replaceable class="parameter">uid</replaceable>
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>CREATE USER</command> is now an alias for
   <link linkend="sql-createrole"><command>CREATE ROLE</command></link>.
   The only difference is that when the command is spelled
   <command>CREATE USER</command>, <literal>LOGIN</literal> is assumed
   by default, whereas <literal>NOLOGIN</literal> is assumed when
   the command is spelled
   <command>CREATE ROLE</command>.
  </para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   The <command>CREATE USER</command> statement is a
   <productname>PostgreSQL</productname> extension.  The SQL standard
   leaves the definition of users to the implementation.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-createrole"/></member>
  </simplelist>
 </refsect1>
</refentry>