ALTER_USER_MAPPING(7)

โœจ ALTER USER MAPPING ๐Ÿ’…

okay bestie, so this is the PostgreSQL 18.6 documentation for ALTER USER MAPPING, and it lives in section 7 of the manual. yes it's giving "change the definition of a user mapping" and honestly? it's iconic. let's get into it ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

ALTER_USER_MAPPING โ€” change the definition of a user mapping


โญ SYNOPSIS โญ

ALTER USER MAPPING FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | SESSION_USER | PUBLIC }
    SERVER server_name
    OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )

no cap, that's the whole shape of it ๐Ÿ’–


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

ALTER USER MAPPING changes the definition of a user mapping. that's it, that's the vibe โœจ

okay but here's the tea on who is allowed to do it, because permissions are literally the main character here:

  • the owner of a foreign server can alter user mappings for that server for any user ๐Ÿ‘‘
  • also, a user can alter a user mapping for their own user name โ€” but only if USAGE privilege on the server has been granted to that user

so like, know your lane, but also know your rights ๐Ÿ’…


๐ŸŽ€ PARAMETERS ๐ŸŽ€

  • user_name โ€” the user name of the mapping. CURRENT_ROLE, CURRENT_USER, and USER all match the name of the current user. and PUBLIC? that one matches all present and future user names in the system. everybody. all of them. ๐ŸŒˆ
  • server_name โ€” the server name of the user mapping.
  • OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) โ€” change options for the user mapping. the new options override any previously specified options. ADD, SET, and DROP specify the action to be performed. ADD is assumed if no operation is explicitly specified (so it's the default, she's the main character by default, periodt). option names must be unique, and options are also validated by the server's foreign-data wrapper. so like, the wrapper gets a say too ๐Ÿงš

๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

change the password for user mapping bob, server foo:

ALTER USER MAPPING FOR bob SERVER foo OPTIONS (SET password 'public');

slay. that's the example. go off bob ๐Ÿ’€


๐Ÿ’œ COMPATIBILITY ๐Ÿ’œ

ALTER USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED). but bestie, there's a subtle syntax issue ๐Ÿ‘€ the standard omits the FOR key word. meanwhile both CREATE USER MAPPING and DROP USER MAPPING use FOR in analogous positions, and IBM DB2 (being the other major SQL/MED implementation) also requires it for ALTER USER MAPPING. so PostgreSQL diverges from the standard here, in the interest of consistency and interoperability. not her being the reasonable one fr fr ๐Ÿ’…


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘


and that's the whole page, bestie!! this was PostgreSQL 18.6, dated 2026, and it's the ALTER USER MAPPING(7) manual page โ€” go forth and alter those mappings responsibly, mwah ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹