1CREATE USER MAPPING(7) PostgreSQL 12.6 Documentation CREATE USER MAPPING(7)
2
3
4
6 CREATE_USER_MAPPING - define a new mapping of a user to a foreign
7 server
8
10 CREATE USER MAPPING [ IF NOT EXISTS ] FOR { user_name | USER | CURRENT_USER | PUBLIC }
11 SERVER server_name
12 [ OPTIONS ( option 'value' [ , ... ] ) ]
13
15 CREATE USER MAPPING defines a mapping of a user to a foreign server. A
16 user mapping typically encapsulates connection information that a
17 foreign-data wrapper uses together with the information encapsulated by
18 a foreign server to access an external data resource.
19
20 The owner of a foreign server can create user mappings for that server
21 for any user. Also, a user can create a user mapping for their own user
22 name if USAGE privilege on the server has been granted to the user.
23
25 IF NOT EXISTS
26 Do not throw an error if a mapping of the given user to the given
27 foreign server already exists. A notice is issued in this case.
28 Note that there is no guarantee that the existing user mapping is
29 anything like the one that would have been created.
30
31 user_name
32 The name of an existing user that is mapped to foreign server.
33 CURRENT_USER and USER match the name of the current user. When
34 PUBLIC is specified, a so-called public mapping is created that is
35 used when no user-specific mapping is applicable.
36
37 server_name
38 The name of an existing server for which the user mapping is to be
39 created.
40
41 OPTIONS ( option 'value' [, ... ] )
42 This clause specifies the options of the user mapping. The options
43 typically define the actual user name and password of the mapping.
44 Option names must be unique. The allowed option names and values
45 are specific to the server's foreign-data wrapper.
46
48 Create a user mapping for user bob, server foo:
49
50 CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret');
51
53 CREATE USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED).
54
56 ALTER USER MAPPING (ALTER_USER_MAPPING(7)), DROP USER MAPPING
57 (DROP_USER_MAPPING(7)), CREATE FOREIGN DATA WRAPPER
58 (CREATE_FOREIGN_DATA_WRAPPER(7)), CREATE SERVER (CREATE_SERVER(7))
59
60
61
62PostgreSQL 12.6 2021 CREATE USER MAPPING(7)