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