DROP_USER_MAPPING(7pg18)

๐Ÿ“ฆ version 18.6, in opensuse-leap 16.0

๐Ÿ’– 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 USAGE privilege 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, and USER all match the name of the current user. meanwhile PUBLIC is 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 ๐ŸŒˆ


โš ๏ธ reminder that dropping stuff is permanent, so vibe check your user_name and server_name before 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