{"Entry":{"collection":"sql","key":"drop-user-mapping","name":"DROP USER MAPPING","aliases":["dropusermapping"],"metadata":{"aliases":["dropusermapping"],"changed_in":["9.0","14"],"changes":[{"from":"8.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"8.4"},{"from":"8.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["DROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_USER | PUBLIC } SERVER server_name"],"removed":["DROP USER MAPPING [ IF EXISTS ] FOR { username | USER | CURRENT_USER | PUBLIC } SERVER servername"]},"to":"9.0"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"9.6"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["DROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER server_name"],"removed":[]},"to":"14"}],"content_hash":"f09a69436e584dca0c6e311ef7dd66182287789eb81bae1cbd922f1b8903d74e","derived_content_hash":"2c66942df494875bb38aa43c919ebf2de15651b7efa78f33ae2bce9a19bfcae8","editorial":{},"first_version":"8.4","group":"foreign","imported_at":"2026-09-30T17:43:38.870613+08:00","last_version":"20","name":"DROP USER MAPPING","object":"USER MAPPING","position":9012,"present_in":["8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"remove a user mapping for a foreign server","purpose_zh":"","related":["create-user-mapping","alter-user-mapping"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:2fddae0d9a1bf5f91734b4fb3886ac9d20ba89cb2e000898b86481886e210a49","receipt_sha256":"91e7c1d027beff3fe64c95be73547e715ad5a95355e97eda6f8238589d374a82","repair":"wiki-repair-20261023"},"slug":"drop-user-mapping","source_rev":"wiki-repair-20261023:e314410eb3ccd6810f41d6d51ed770d8a3c4d64541fb674a43057b98345157cd","synopsis":"DROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER server_name","verb":"DROP"}},"Definition":{"Collection":"sql","Key":"drop-user-mapping","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"drop-user-mapping","SourceRevision":"wiki-repair-20261023:e314410eb3ccd6810f41d6d51ed770d8a3c4d64541fb674a43057b98345157cd","Facts":{"anchor":"SQL-DROPUSERMAPPING","description_zh":"删除外部服务器的用户映射","description_zh_html":"\u003cpre\u003eDROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER server_name\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP USER MAPPING\u003c/code\u003e 删除外部服务器上的一个现有用户映射。\n  \u003c/p\u003e\u003cp\u003e\n   外部服务器的拥有者可以删除任意用户到该服务器的用户映射。此外，如果某个用户已被授予该服务器上的 \u003ccode class=\"literal\"\u003eUSAGE\u003c/code\u003e 权限，那么该用户也可以删除其自己用户名对应的用户映射。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      如果该用户映射不存在，则不要报错。这种情况下会发出一个提示。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003euser_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      该映射的用户名。\u003ccode class=\"literal\"\u003eCURRENT_ROLE\u003c/code\u003e、\u003ccode class=\"literal\"\u003eCURRENT_USER\u003c/code\u003e 和 \u003ccode class=\"literal\"\u003eUSER\u003c/code\u003e 匹配当前用户的名称。\u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e 用于匹配系统中当前及未来的所有用户名。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eserver_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      该用户映射所属服务器的名称。\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   如果用户 \u003ccode class=\"literal\"\u003ebob\u003c/code\u003e 在服务器 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e 上的用户映射存在，则将其删除：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nDROP USER MAPPING IF EXISTS FOR bob SERVER foo;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eDROP USER MAPPING\u003c/code\u003e 符合 ISO/IEC 9075-9（SQL/MED）。\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e 子句是 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 扩展。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-createusermapping.html\" title=\"CREATE USER MAPPING\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE USER MAPPING\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterusermapping.html\" title=\"ALTER USER MAPPING\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER USER MAPPING\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-dropusermapping.html","lang":"en","name":"DROP USER MAPPING","purpose":"remove a user mapping for a foreign server","purpose_zh":"删除外部服务器的用户映射","related":["create-user-mapping","alter-user-mapping"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP USER MAPPING\u003c/code\u003e removes an existing user mapping from foreign server.\u003c/p\u003e\u003cp\u003eThe 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 \u003ccode class=\"literal\"\u003eUSAGE\u003c/code\u003e privilege on the server has been granted to the user.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the user mapping does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003euser_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eUser name of the mapping. \u003ccode class=\"literal\"\u003eCURRENT_ROLE\u003c/code\u003e, \u003ccode class=\"literal\"\u003eCURRENT_USER\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eUSER\u003c/code\u003e match the name of the current user. \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e is used to match all present and future user names in the system.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eserver_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eServer name of the user mapping.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eDrop a user mapping \u003ccode class=\"literal\"\u003ebob\u003c/code\u003e, server \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e if it exists:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP USER MAPPING IF EXISTS FOR bob SERVER foo;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP USER MAPPING\u003c/code\u003e conforms to ISO/IEC 9075-9 (SQL/MED). The \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e clause is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-user-mapping/?v=18\" title=\"CREATE USER MAPPING\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE USER MAPPING\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-user-mapping/?v=18\" title=\"ALTER USER MAPPING\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER USER MAPPING\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"DROP USER MAPPING [ IF EXISTS ] FOR { \u003cem class=\"replaceable\"\u003e\u003ccode\u003euser_name\u003c/code\u003e\u003c/em\u003e | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER \u003cem class=\"replaceable\"\u003e\u003ccode\u003eserver_name\u003c/code\u003e\u003c/em\u003e","synopsis_text":"DROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER server_name","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-dropusermapping.html","sha256":"ccddaa317c3548919f2a95604f048d56d668d587c8964834c07d3d5501d38233"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"drop-user-mapping","SourceDatabase":"center","Version":"18","Locale":"en","Title":"DROP USER MAPPING","Summary":"remove a user mapping for a foreign server","BodyHTML":"\u003cpre\u003eDROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER server_name\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP USER MAPPING\u003c/code\u003e removes an existing user mapping from foreign server.\u003c/p\u003e\u003cp\u003eThe 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 \u003ccode\u003eUSAGE\u003c/code\u003e privilege on the server has been granted to the user.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the user mapping does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003euser_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eUser name of the mapping. \u003ccode\u003eCURRENT_ROLE\u003c/code\u003e, \u003ccode\u003eCURRENT_USER\u003c/code\u003e, and \u003ccode\u003eUSER\u003c/code\u003e match the name of the current user. \u003ccode\u003ePUBLIC\u003c/code\u003e is used to match all present and future user names in the system.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003eserver_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eServer name of the user mapping.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003eDrop a user mapping \u003ccode\u003ebob\u003c/code\u003e, server \u003ccode\u003efoo\u003c/code\u003e if it exists:\u003c/p\u003e\u003cpre\u003eDROP USER MAPPING IF EXISTS FOR bob SERVER foo;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP USER MAPPING\u003c/code\u003e conforms to ISO/IEC 9075-9 (SQL/MED). The \u003ccode\u003eIF EXISTS\u003c/code\u003e clause is a \u003cspan\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/create-user-mapping/?v=18\" title=\"CREATE USER MAPPING\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE USER MAPPING\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-user-mapping/?v=18\" title=\"ALTER USER MAPPING\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER USER MAPPING\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:e314410eb3ccd6810f41d6d51ed770d8a3c4d64541fb674a43057b98345157cd","ContentHash":"17d8b9f432b6e0374f72062dbc437fd74962f1e0d9e473438e19277d47ddb509","Payload":{"related":["create-user-mapping","alter-user-mapping"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP USER MAPPING\u003c/code\u003e removes an existing user mapping from foreign server.\u003c/p\u003e\u003cp\u003eThe 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 \u003ccode class=\"literal\"\u003eUSAGE\u003c/code\u003e privilege on the server has been granted to the user.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eDo not throw an error if the user mapping does not exist. A notice is issued in this case.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003euser_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eUser name of the mapping. \u003ccode class=\"literal\"\u003eCURRENT_ROLE\u003c/code\u003e, \u003ccode class=\"literal\"\u003eCURRENT_USER\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eUSER\u003c/code\u003e match the name of the current user. \u003ccode class=\"literal\"\u003ePUBLIC\u003c/code\u003e is used to match all present and future user names in the system.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eserver_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eServer name of the user mapping.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eDrop a user mapping \u003ccode class=\"literal\"\u003ebob\u003c/code\u003e, server \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e if it exists:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eDROP USER MAPPING IF EXISTS FOR bob SERVER foo;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP USER MAPPING\u003c/code\u003e conforms to ISO/IEC 9075-9 (SQL/MED). The \u003ccode class=\"literal\"\u003eIF EXISTS\u003c/code\u003e clause is a \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-user-mapping/?v=18\" title=\"CREATE USER MAPPING\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE USER MAPPING\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/alter-user-mapping/?v=18\" title=\"ALTER USER MAPPING\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER USER MAPPING\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"DROP USER MAPPING [ IF EXISTS ] FOR { \u003cem class=\"replaceable\"\u003e\u003ccode\u003euser_name\u003c/code\u003e\u003c/em\u003e | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER \u003cem class=\"replaceable\"\u003e\u003ccode\u003eserver_name\u003c/code\u003e\u003c/em\u003e","synopsis_text":"DROP USER MAPPING [ IF EXISTS ] FOR { user_name | USER | CURRENT_ROLE | CURRENT_USER | PUBLIC } SERVER server_name"}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
