ALTER_USER_MAPPING(7pg14)

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

πŸ’– NAME πŸ’–

okay so bestie, welcome to the ALTER USER MAPPING page β€” manual 7pg14, straight out of the PostgreSQL 14.24 documentation. πŸ’… ALTER_USER_MAPPING β€” change the definition of a user mapping. That's the whole assignment, and honestly it's giving very specific but very useful energy. πŸŽ€


✨ 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 πŸ¦‹

ALTER USER MAPPING changes the definition of a user mapping. ✨

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. So yes, sometimes you can do your own thing, but only with the right privilege, iykyk. πŸ”‘


🌸 PARAMETERS 🌸

  • user_name β€” user name of the mapping. 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. so many ways to say "this user," bestie πŸ’œ
  • server_name β€” server name of the user mapping. the server, obviously, but make it precise ✨
  • 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. validated by the server's foreign-data wrapper, no cap πŸ”₯

πŸŽ€ EXAMPLES πŸŽ€

Change the password for user mapping bob, server foo:

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

that's it, that's the example, and it ate πŸ’š

πŸ’« COMPATIBILITY πŸ’«

ALTER USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED). There is 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. consistency and interoperability slay, honestly 🌈

πŸ”₯ SEE ALSO πŸ”₯

go read those too if you're doing the whole user-mapping cinematic universe 🫢

xoxo, from PostgreSQL 14.24, dated 2026, page ALTER USER MAPPING(7) β€” bye bestie! πŸ’–βœ¨

πŸ“¦ where this page comes from