3 PostgreSQL documentation
6 <refentry id=
"SQL-CREATEUSERMAPPING">
8 <refentrytitle id=
"sql-createusermapping-title">CREATE USER MAPPING
</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
14 <refname>CREATE USER MAPPING
</refname>
15 <refpurpose>define a new mapping of a user to a foreign server
</refpurpose>
18 <indexterm zone=
"sql-createusermapping">
19 <primary>CREATE USER MAPPING
</primary>
24 CREATE USER MAPPING FOR {
<replaceable class=
"parameter">username
</replaceable> | USER | CURRENT_USER | PUBLIC }
25 SERVER
<replaceable class=
"parameter">servername
</replaceable>
26 [ OPTIONS (
<replaceable class=
"PARAMETER">option
</replaceable> '
<replaceable class=
"PARAMETER">value
</replaceable>' [ , ... ] ) ]
31 <title>Description
</title>
34 <command>CREATE USER MAPPING
</command> defines a mapping of a user
35 to a foreign server. A user mapping typically encapsulates
36 connection information that a foreign-data wrapper uses together
37 with the information encapsulated be a foreign server to access an
38 external data resource.
42 The owner of a foreign server can create user mappings for that
43 server for any user. Also, a user can create a user mapping for
44 his own user name if
<literal>USAGE<
/> privilege on the server has
45 been granted to the user.
50 <title>Parameters
</title>
54 <term><replaceable class=
"parameter">username
</replaceable></term>
57 The name of an existing user that is mapped to foreign server.
58 <literal>CURRENT_USER<
/> and
<literal>USER<
/> match the name of
59 the current user. When
<literal>PUBLIC<
/> is specified, a
60 so-called public mapping is created that is used when no
61 user-specific mapping is applicable.
67 <term><replaceable class=
"parameter">servername
</replaceable></term>
70 The name of an existing server for which the user mapping is
77 <term><literal>OPTIONS (
<replaceable class=
"PARAMETER">option
</replaceable> '
<replaceable class=
"PARAMETER">value
</replaceable>' [, ... ] )
</literal></term>
80 This clause specifies the options of the user mapping. The
81 options typically define the actual user name and password of
82 the mapping. Option names must be unique. The allowed option
83 names and values are specific to the server's foreign-data wrapper.
91 <title>Examples
</title>
94 Create a user mapping for user
<literal>bob<
/>, server
<literal>foo<
/>:
96 CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret');
103 <title>Compatibility
</title>
106 <command>CREATE USER MAPPING
</command> conforms to ISO/IEC
9075-
9 (SQL/MED).
111 <title>See Also
</title>
113 <simplelist type=
"inline">
114 <member><xref linkend=
"sql-alterusermapping" endterm=
"sql-alterusermapping-title"></member>
115 <member><xref linkend=
"sql-dropusermapping" endterm=
"sql-dropusermapping-title"></member>
116 <member><xref linkend=
"sql-createforeigndatawrapper" endterm=
"sql-createforeigndatawrapper-title"></member>
117 <member><xref linkend=
"sql-createserver" endterm=
"sql-createserver-title"></member>