ALTER_USER_MAPPING(7pg14)
π 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, andUSERmatch the name of the current user.PUBLICis 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, andDROPspecify the action to be performed.ADDis 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 π₯
CREATE USER MAPPING(CREATE_USER_MAPPING(7))DROP USER MAPPING(DROP_USER_MAPPING(7))
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
- 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