DROP_USER_MAPPING(7)
๐ DROP USER MAPPING ๐
okay bestie, welcome to DROP USER MAPPING(7) โ yes that's the manual name, it's giving "PostgreSQL 18.6 Documentation" energy and honestly? iconic. let's get into it ๐ซถ
โจ NAME โจ
DROP_USER_MAPPING โ bestie, this is the one that removes a user mapping for a foreign server. that's it, that's the whole job, and she does it flawlessly ๐
๐ธ SYNOPSIS ๐ธ
DROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER server_name
no cap, that's the whole shape of it. the curly braces are pick-one, the square brackets are optional, you know the drill ๐
๐ฆ DESCRIPTION ๐ฆ
so like. DROP USER MAPPING removes an existing user mapping from foreign server. poof. gone. it's not that deep but it IS that serious โจ
now here's the permission tea, and you NEED to know this:
- the owner of a foreign server can drop user mappings for that server for any user โ yes, ANY user, she has range ๐
- ALSO, a user can drop a user mapping for their own user name if
USAGEprivilege on the server has been granted to the user. that's the catch, bestie, no privilege no drop ๐ญ
๐ PARAMETERS ๐
IF EXISTSโ do NOT throw an error if the user mapping doesn't exist. instead a notice is issued in this case. it's giving gentle, non-confrontational, we-don't-do-drama energy ๐๏ธuser_nameโ user name of the mapping. and here's the little glow-up:CURRENT_ROLE,CURRENT_USER, andUSERall match the name of the current user. meanwhilePUBLICis used to match all present and future user names in the system โ like, every single one, forever, no exceptions, she's committed ๐server_nameโ server name of the user mapping. just the server, bestie. that's the whole thing ๐ธ
๐ง EXAMPLES ๐ง
okay so let's say you wanna drop a user mapping bob, server foo if it exists. drop a user mapping bob, server foo if it exists. that's literally the example, look:
DROP USER MAPPING IF EXISTS FOR bob SERVER foo;
ate. no crumbs. โจ
๐ COMPATIBILITY ๐
DROP USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED) โ yes ma'am, standards-compliant, she's certified ๐
BUT. the IF EXISTS clause is a PostgreSQL extension. so if you're out here in other databases expecting that clause, bestie... it's not there. iykyk ๐
๐ SEE ALSO ๐
CREATE USER MAPPING(CREATE_USER_MAPPING(7)) โ the birth, the origin story ๐ฆALTER USER MAPPING(ALTER_USER_MAPPING(7)) โ the glow-up era ๐
โ ๏ธ reminder that dropping stuff is permanent, so vibe check youruser_nameandserver_namebefore you hit enter, fr fr ๐ญ
okay that's the whole page, you're literally a user-mapping expert now, no cap ๐
PostgreSQL 18.6 ยท 2026 ยท DROP USER MAPPING(7) โ mwah, thanks for reading bestie, slay your day ๐โจ๐
๐ฆ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 ยท PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 ยท PostgreSQL
- arch rolling: postgresql 18.6-4 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 ยท PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms