CREATE USER MAPPING
Synopsis
Use the CREATE USER MAPPING
command to define the mapping of a specific user to authorization credentials in the foreign server. The foreign-data wrapper uses the information provided by the foreign server and the user mapping to connect to the external data source.
The owner of a foreign server can create user mappings for the server for any user. Moreover, a user can create user mapping for themself if they have USAGE
privilege on the server.
Syntax
create_user_mapping ::= CREATE USER MAPPING [ IF NOT EXISTS ] FOR user
SERVER server_name [ OPTIONS ( fdw_options ) ]
create_user_mapping
Semantics
Create a user mapping for the user user_name for the server server_name. If a mapping between the user and the foreign server already exists, an error will be raised unless the IF NOT EXISTS
clause is used.
Options:
The OPTIONS
clause specifies options for the foreign-data server. They typically define the mapped username and password to be used on the external data source, but the actual permitted option names and values are specific to the server’s foreign data wrapper.
Examples
Basic example.
yugabyte=# CREATE USER MAPPING FOR myuser SERVER my_server OPTIONS (user 'john', password 'password');