CREATE_USER_MAPPING(7pg14)
π CREATE USER MAPPING π
okay bestie, this is the CREATE USER MAPPING(7) page from the PostgreSQL 14.24 documentation, and weβre gonna make it make sense fr fr π«Άβ¨
πΈ NAME πΈ
CREATE_USER_MAPPING β define a new mapping of a user to a foreign server. thatβs the whole vibe π«
β¨ SYNOPSIS β¨
CREATE USER MAPPING [ IF NOT EXISTS ] FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC }
SERVER server_name
[ OPTIONS ( option 'value' [ , ... ] ) ]
π DESCRIPTION π
CREATE USER MAPPING 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. itβs giving βhereβs how this user connects over thereβ π₯
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 USAGE privilege on the server has been granted to the user. periodt π
π PARAMETERS π
IF NOT EXISTSβ 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. so likeβ¦ it exists, but donβt assume itβs your fave πuser_nameβ the name of an existing user that is mapped to foreign server.CURRENT_ROLE,CURRENT_USER, andUSERmatch the name of the current user. whenPUBLICis specified, a so-called public mapping is created that is used when no user-specific mapping is applicable. iconic fallback behavior ngl πserver_nameβ the name of an existing server for which the user mapping is to be created.OPTIONS ( option 'value' [, ... ] )β 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βs foreign-data wrapper. so yeah, check with your FDW bestie before you go wild π¦
π EXAMPLES π
create a user mapping for user bob, server foo:
CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret');
slay, bob is mapped π β¨
π COMPATIBILITY π
CREATE USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED). standards girlie behavior, we love to see it π
π§ SEE ALSO π§
ALTER USER MAPPING(ALTER_USER_MAPPING(7))DROP USER MAPPING(DROP_USER_MAPPING(7))CREATE FOREIGN DATA WRAPPER(CREATE_FOREIGN_DATA_WRAPPER(7))CREATE SERVER(CREATE_SERVER(7))
mwah π this page is brought to you by PostgreSQL 14.24, dated 2026. go forth and map responsibly, bestie π«Άπ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms