Defines a new mapping of a user to a foreign server.

Synopsis

  1. CREATE USER MAPPING FOR { <username> | USER | CURRENT_USER | PUBLIC }
  2. SERVER <servername>
  3. [ OPTIONS ( <option> '<value>' [, ... ] ) ]

Description

CREATE USER MAPPING defines a mapping of a user to a foreign server. You must be the owner of the server to define user mappings for it.

Parameters

username

The name of an existing user that is mapped to the foreign server. CURRENT_USER and USER match the name of the current user. PUBLIC is used to match all present and future user names in the system.

servername

The name of an existing server for which Greenplum Database is to create the user mapping.

OPTIONS ( option ‘value’ [, … ] )

The options for the new user mapping. The options typically define the actual user name and password of the mapping. Option names must be unique. The option names and values are specific to the server’s foreign-data wrapper.

Examples

Create a user mapping for user bob, server foo:

  1. CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret');

Compatibility

CREATE USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED).

See Also

ALTER USER MAPPING, DROP USER MAPPING, DROP USER MAPPING, CREATE FOREIGN DATA WRAPPER, CREATE SERVER

Parent topic: SQL Commands