DROP_USER_MAPPING(7pg13)

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

πŸ’… DROP USER MAPPING πŸ’…

okay bestie, so this one is a PostgreSQL 13.23 page β€” yeah, the docs manual, we're fancy β€” and it's all about yeeting a user mapping off a foreign server. let's get into it 🫢


🌸 NAME 🌸

DROP_USER_MAPPING β€” removes a user mapping for a foreign server. that's it, that's the whole vibe. goodbye mapping, don't let the door hit you πŸ’…


✨ SYNOPSIS ✨

DROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_USER | PUBLIC } SERVER server_name

look at all those options, she's got range πŸ”₯


πŸ¦‹ DESCRIPTION πŸ¦‹

so like β€” DROP USER MAPPING removes an existing user mapping from a foreign server. iconic behavior, honestly.

now here's the permission tea β˜• the owner of a foreign server can drop user mappings for that server for any user. also, a user can drop a user mapping for their own user name if USAGE privilege on the server has been granted to that user. basically: you can clean up your own mess, or the server owner can clean up everybody's 😭


πŸŽ€ PARAMETERS πŸŽ€

  • IF EXISTS β€” do not throw an error if the user mapping doesn't exist. instead a notice gets issued. no dramatics, no explosion, just a lil heads up πŸ’–
  • user_name β€” the user name of the mapping. 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. she's giving main character energy, matching everyone πŸ‘‘
  • server_name β€” the server name of the user mapping. yep. that's the one πŸ¦‹

🌈 EXAMPLES 🌈

drop a user mapping bob, server foo, if it exists:

DROP USER MAPPING IF EXISTS FOR bob SERVER foo;

see how chill that was? no error, no stress, just IF EXISTS doing her thing ✨


πŸ’œ COMPATIBILITY πŸ’œ

DROP USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED) β€” standards girlie behavior, we love to see it. but the IF EXISTS clause? that's a PostgreSQL extension. homegrown. artisanal. locally sourced πŸ“


⭐ SEE ALSO ⭐

iykyk, it's the full mapping lifecycle πŸ’«


ok that's the whole page bestie, no cap, nothing skipped. every flag, every privilege, every standard reference β€” all present and accounted for πŸ’…

PostgreSQL 13.23, dated 2025 β€” mwah, signed off, slay πŸ’–βœ¨

πŸ“¦ where this page comes from