ALTER_USER_MAPPING(7pg15)

πŸ“¦ version 15.19, in opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay so this is ALTER USER MAPPING(7) from the PostgreSQL 15.19 Documentation, and the vibe is: ALTER_USER_MAPPING β€” change the definition of a user mapping. slay. πŸ’…

✨ SYNOPSIS ✨

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

πŸ¦‹ DESCRIPTION πŸ¦‹

bestie, ALTER USER MAPPING changes the definition of a user mapping. that's the whole main character move.

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 if USAGE privilege on the server has been granted to the user. fr fr. 🫢

πŸŽ€ PARAMETERS πŸŽ€

  • user_name β€” user name of the mapping. the names CURRENT_ROLE, 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. and yes, the synopsis also lists SESSION_USER, so don't skip it, bestie. ✨
  • server_name β€” server name of the user mapping. simple as that. πŸ¦‹
  • 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. option names must be unique; options are also validated by the server's foreign-data wrapper. no cap, that last part matters. πŸ’€

🌸 EXAMPLES 🌸

change the password for user mapping bob, server foo:

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

ate. πŸ’…

πŸ’… COMPATIBILITY πŸ’…

ALTER USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED). but girlypop, there's a subtle syntax issue: the standard omits the FOR key word.

since 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, PostgreSQL diverges from the standard here in the interest of consistency and interoperability. iconic behavior, honestly. πŸ‘‘

πŸ”₯ SEE ALSO πŸ”₯


k bye bestie πŸ’… β€” this page is from PostgreSQL 15.19 docs, dated 2026, and it's ALTER USER MAPPING(7) all the way. periodt ✨

πŸ“¦ where this page comes from