CREATE_USER_MAPPING(7pg13)
π CREATE USER MAPPING
okay so this is the CREATE USER MAPPING page from the PostgreSQL 13.23 Documentation, and bestie, it's literally about giving a user a lil passport to a foreign server. Buckle up π¦
β¨ NAME β¨
CREATE_USER_MAPPING β define a new mapping of a user to a foreign server π
π SYNOPSIS π
CREATE USER MAPPING [ IF NOT EXISTS ] FOR { user_name | USER | CURRENT_USER | PUBLIC }
SERVER server_name
[ OPTIONS ( option 'value' [ , ... ] ) ]
look at her. gorgeous. no notes. π
πΈ DESCRIPTION πΈ
So CREATE USER MAPPING defines a mapping of a user to a foreign server. Basically it's the glow-up that says "hey, this human belongs to this 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. (Yes, that's a lot of words β the vibe is: your mapping holds the connection bits, the foreign server holds the server bits, and together they get you to the external data. team work makes the dream work π«Ά)
Now the permission tea β: 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 β but only if USAGE privilege on the server has been granted to that user. know your rights, girlie π
π¦ 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 instead, so it's giving "we're not mad, we're just disappointed" π. Note that there is no guarantee that the existing user mapping is anything like the one that would have been created β so like, don't assume she's the same girl.user_nameβ the name of an existing user that is mapped to foreign server.CURRENT_USERandUSERboth match the name of the current user (iconic shortcuts honestly). WhenPUBLICis specified, a so-called public mapping is created that is used when no user-specific mapping is applicable β she's the default, the fallback, the main character of last resort πserver_nameβ the name of an existing server for which the user mapping is to be created. gotta exist already, no inventing servers out here π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 (yes, the juicy stuff π₯). Option names must be unique β no duplicates, that's so not slay. The allowed option names and values are specific to the server's foreign-data wrapper, so check with your wrapper before you commit, iykyk.
β EXAMPLES β
Create a user mapping for user bob, server foo:
CREATE USER MAPPING FOR bob SERVER foo OPTIONS (user 'bob', password 'secret');
look at bob. connected. thriving. we love to see it π
π COMPATIBILITY π
CREATE USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED). standards-compliant queen, periodt. π
π§ 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))
and that's the whole page, bestie π this lil manual page is brought to you by PostgreSQL 13.23, dated 2025 β go forth and map your users, you absolute legend πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-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