]> begriffs open source - ai-pg/blob - full-docs/man7/CREATE_USER_MAPPING.7
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / man7 / CREATE_USER_MAPPING.7
1 '\" t
2 .\"     Title: CREATE USER MAPPING
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "CREATE USER MAPPING" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 CREATE_USER_MAPPING \- define a new mapping of a user to a foreign server
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 CREATE USER MAPPING [ IF NOT EXISTS ] FOR { \fIuser_name\fR | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC }
36     SERVER \fIserver_name\fR
37     [ OPTIONS ( \fIoption\fR \*(Aq\fIvalue\fR\*(Aq [ , \&.\&.\&. ] ) ]
38 .fi
39 .SH "DESCRIPTION"
40 .PP
41 \fBCREATE USER MAPPING\fR
42 defines a mapping of a user to a foreign server\&. A user mapping typically encapsulates connection information that a foreign\-data wrapper uses together with the information encapsulated by a foreign server to access an external data resource\&.
43 .PP
44 The owner of a foreign server can create user mappings for that server for any user\&. Also, a user can create a user mapping for their own user name if
45 USAGE
46 privilege on the server has been granted to the user\&.
47 .SH "PARAMETERS"
48 .PP
49 IF NOT EXISTS
50 .RS 4
51 Do not throw an error if a mapping of the given user to the given foreign server already exists\&. A notice is issued in this case\&. Note that there is no guarantee that the existing user mapping is anything like the one that would have been created\&.
52 .RE
53 .PP
54 \fIuser_name\fR
55 .RS 4
56 The name of an existing user that is mapped to foreign server\&.
57 CURRENT_ROLE,
58 CURRENT_USER, and
59 USER
60 match the name of the current user\&. When
61 PUBLIC
62 is specified, a so\-called public mapping is created that is used when no user\-specific mapping is applicable\&.
63 .RE
64 .PP
65 \fIserver_name\fR
66 .RS 4
67 The name of an existing server for which the user mapping is to be created\&.
68 .RE
69 .PP
70 OPTIONS ( \fIoption\fR \*(Aq\fIvalue\fR\*(Aq [, \&.\&.\&. ] )
71 .RS 4
72 This clause specifies the options of the user mapping\&. The options typically define the actual user name and password of the mapping\&. Option names must be unique\&. The allowed option names and values are specific to the server\*(Aqs foreign\-data wrapper\&.
73 .RE
74 .SH "EXAMPLES"
75 .PP
76 Create a user mapping for user
77 bob, server
78 foo:
79 .sp
80 .if n \{\
81 .RS 4
82 .\}
83 .nf
84 CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user \*(Aqbob\*(Aq, password \*(Aqsecret\*(Aq);
85 .fi
86 .if n \{\
87 .RE
88 .\}
89 .SH "COMPATIBILITY"
90 .PP
91 \fBCREATE USER MAPPING\fR
92 conforms to ISO/IEC 9075\-9 (SQL/MED)\&.
93 .SH "SEE ALSO"
94 ALTER USER MAPPING (\fBALTER_USER_MAPPING\fR(7)), DROP USER MAPPING (\fBDROP_USER_MAPPING\fR(7)), CREATE FOREIGN DATA WRAPPER (\fBCREATE_FOREIGN_DATA_WRAPPER\fR(7)), CREATE SERVER (\fBCREATE_SERVER\fR(7))