DROP_USER_MAPPING(7pg15)

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

✨ DROP_USER_MAPPING ✨

okay so bestie, welcome to the DROP_USER_MAPPING page from the PostgreSQL 15.19 Documentation β€” that’s the manual name right there, and we are officially here to remove a user mapping for a foreign server. it’s giving β€œclean up the foreign-server linkage” energy, no cap πŸ’….

🌸 NAME 🌸

DROP_USER_MAPPING β€” remove a user mapping for a foreign server.

πŸŽ€ SYNOPSIS πŸŽ€

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

πŸ’– DESCRIPTION πŸ’–

DROP USER MAPPING removes an existing user mapping from foreign server.

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 the user. so the permission vibe check is: server owner can do it for anybody on that server; a regular user can do it for their own user name, but only when USAGE is granted 🫢.

✨ PARAMETERS ✨

  • IF EXISTS β€” do not throw an error if the user mapping does not exist. A notice is issued in this case. so like, no dramatic crash if it’s already gone, just a lil notice πŸŽ€.
  • 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. slay for future-proofing 🌈.
  • server_name β€” server name of the user mapping. this is the server you’re pointing at, bestie.

πŸ’… EXAMPLES πŸ’…

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

DROP USER MAPPING IF EXISTS FOR bob SERVER foo;

πŸ”₯ COMPATIBILITY πŸ”₯

DROP USER MAPPING conforms to ISO/IEC 9075-9 (SQL/MED). The IF EXISTS clause is a PostgreSQL extension. love that for us: standards-compliant with a lil PostgreSQL bonus ✨.

πŸ‘‘ SEE ALSO πŸ‘‘


big kiss and a sparkle send-off: this was PostgreSQL 15.19, dated 2026, and the page is DROP USER MAPPING(7). periodt πŸ’œ

πŸ“¦ where this page comes from