{"Entry":{"collection":"sql","key":"drop-owned","name":"DROP OWNED","aliases":["drop-owned"],"metadata":{"aliases":["drop-owned"],"changed_in":["9.5","14"],"changes":[{"from":"8.1","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"8.2"},{"from":"8.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes"],"removed":[]},"status":"changed","synopsis":null,"to":"8.3"},{"from":"9.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes","compatibility"],"removed":[]},"status":"changed","synopsis":null,"to":"9.1"},{"from":"9.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"9.4"},{"from":"9.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["DROP OWNED BY { name | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]"],"removed":[]},"to":"9.5"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","notes"],"removed":[]},"status":"changed","synopsis":null,"to":"9.6"},{"from":"11","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"12"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":{"added":["DROP OWNED BY { name | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]"],"removed":[]},"to":"14"},{"from":"14","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description"],"removed":[]},"status":"changed","synopsis":null,"to":"15"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","notes"],"removed":[]},"status":"changed","synopsis":null,"to":"17"},{"from":"18","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"19"}],"content_hash":"fb73d8a729c2a0540337e676fecb1d48471b314db2637c0a209569cf9fb36af9","editorial":{},"first_version":"8.2","group":"role","imported_at":"2026-09-30T17:43:38.096768+08:00","last_version":"20","name":"DROP OWNED","object":"OWNED","position":5007,"present_in":["8.2","8.3","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 database objects owned by a database role","purpose_zh":"","related":["reassign-owned","drop-role"],"slug":"drop-owned","source_rev":"a709ab85","synopsis":"DROP OWNED BY { name | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]","verb":"DROP"}},"Definition":{"Collection":"sql","Key":"drop-owned","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"drop-owned","SourceRevision":"a709ab85","Facts":{"anchor":"SQL-DROP-OWNED","file":"sql-drop-owned.html","lang":"en","name":"DROP OWNED","purpose":"remove database objects owned by a database role","purpose_zh":"","related":["reassign-owned","drop-role"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e drops all the objects within the current database that are owned by one of the specified roles. Any privileges granted to the given roles on objects in the current database or on shared objects (databases, tablespaces, configuration parameters) will also be revoked.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of a role whose objects will be dropped, and whose privileges will be revoked.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eAutomatically drop objects that depend on the affected objects, and in turn all objects that depend on those objects (see \u003ca href=\"/docs/18/ddl-depend.html\" title=\"5.15. Dependency Tracking\"\u003eSection 5.15\u003c/a\u003e).\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eRefuse to drop the objects owned by a role if any other database objects depend on one of the affected objects. This is the default.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e is often used to prepare for the removal of one or more roles. Because \u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e only affects the objects in the current database, it is usually necessary to execute this command in each database that contains objects owned by a role that is to be removed.\u003c/p\u003e\u003cp\u003eUsing the \u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e option might make the command recurse to objects owned by other users.\u003c/p\u003e\u003cp\u003eThe \u003ca href=\"/docs/18/sql-reassign-owned.html\" title=\"REASSIGN OWNED\"\u003e\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e\u003c/a\u003e command is an alternative that reassigns the ownership of all the database objects owned by one or more roles. However, \u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e does not deal with privileges for other objects.\u003c/p\u003e\u003cp\u003eDatabases and tablespaces owned by the role(s) will not be removed.\u003c/p\u003e\u003cp\u003eSee \u003ca href=\"/docs/18/role-removal.html\" title=\"21.4. Dropping Roles\"\u003eSection 21.4\u003c/a\u003e for more discussion.\u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003eThe \u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e command 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/reassign-owned/?v=18\" title=\"REASSIGN OWNED\"\u003e\u003cspan class=\"refentrytitle\"\u003eREASSIGN OWNED\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-role/?v=18\" title=\"DROP ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP ROLE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"DROP OWNED BY { \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]","synopsis_text":"DROP OWNED BY { name | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"drop-owned","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"DROP OWNED","Summary":"移除一个数据库角色所拥有的数据库对象","BodyHTML":"\u003cpre\u003eDROP OWNED BY { name | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP OWNED\u003c/code\u003e删除当前数据库中由指定角色之一拥有的所有对象。同时，授予给这些角色的、针对当前数据库中的对象或共享对象（数据库、表空间、配置参数）的任何权限也会被撤销。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e一个角色的名称；该角色拥有的对象将被删除，并且授予给该角色的权限将被撤销。\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e自动删除依赖于受影响对象的对象，并进一步删除所有依赖于这些对象的对象（参见\u003ca href=\"/docs/18/ddl-depend.html\" rel=\"nofollow\"\u003e第 5.15 节\u003c/a\u003e）。\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e如果有其他数据库对象依赖于某个受影响对象，则拒绝删除该角色拥有的对象。这是默认值。\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e注解\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP OWNED\u003c/code\u003e经常被用来为移除一个或多个角色做准备。因为\u003ccode\u003eDROP OWNED\u003c/code\u003e只影响当前数据库中的对象，所以通常需要在包含待移除角色所拥有对象的每个数据库中执行此命令。\u003c/p\u003e\u003cp\u003e使用\u003ccode\u003eCASCADE\u003c/code\u003e选项可能会使该命令递归到由其他用户拥有的对象。\u003c/p\u003e\u003cp\u003e\u003ca href=\"/docs/18/sql-reassign-owned.html\" title=\"REASSIGN OWNED\" rel=\"nofollow\"\u003e\u003ccode\u003eREASSIGN OWNED\u003c/code\u003e\u003c/a\u003e命令提供了另一种选择，它会重新分配由一个或多个角色拥有的所有数据库对象的拥有关系。不过，\u003ccode\u003eREASSIGN OWNED\u003c/code\u003e不处理针对其他对象的权限。\u003c/p\u003e\u003cp\u003e由这些角色拥有的数据库和表空间不会被移除。\u003c/p\u003e\u003cp\u003e更多讨论请见\u003ca href=\"/docs/18/role-removal.html\" rel=\"nofollow\"\u003e第 21.4 节\u003c/a\u003e。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eDROP OWNED\u003c/code\u003e命令是\u003cspan\u003ePostgreSQL\u003c/span\u003e扩展。\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/reassign-owned/?v=18\" title=\"REASSIGN OWNED\" rel=\"nofollow\"\u003e\u003cspan\u003eREASSIGN OWNED\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-role/?v=18\" title=\"DROP ROLE\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP ROLE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"1b5ca64c","ContentHash":"adb02b9f4ae1b120e016c2ad2ef8807ffb7ba8898fae54d496df8f05f4223bcc","Payload":{"purpose_zh":"移除一个数据库角色所拥有的数据库对象","sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e删除当前数据库中由指定角色之一拥有的所有对象。同时，授予给这些角色的、针对当前数据库中的对象或共享对象（数据库、表空间、配置参数）的任何权限也会被撤销。\u003c/p\u003e","key":"description","title":"描述"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e一个角色的名称；该角色拥有的对象将被删除，并且授予给该角色的权限将被撤销。\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e自动删除依赖于受影响对象的对象，并进一步删除所有依赖于这些对象的对象（参见\u003ca href=\"/docs/18/ddl-depend.html\" title=\"5.15. 依赖跟踪\"\u003e第 5.15 节\u003c/a\u003e）。\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eRESTRICT\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e如果有其他数据库对象依赖于某个受影响对象，则拒绝删除该角色拥有的对象。这是默认值。\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"参数"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e经常被用来为移除一个或多个角色做准备。因为\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e只影响当前数据库中的对象，所以通常需要在包含待移除角色所拥有对象的每个数据库中执行此命令。\u003c/p\u003e\u003cp\u003e使用\u003ccode class=\"literal\"\u003eCASCADE\u003c/code\u003e选项可能会使该命令递归到由其他用户拥有的对象。\u003c/p\u003e\u003cp\u003e\u003ca href=\"/docs/18/sql-reassign-owned.html\" title=\"REASSIGN OWNED\"\u003e\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e\u003c/a\u003e命令提供了另一种选择，它会重新分配由一个或多个角色拥有的所有数据库对象的拥有关系。不过，\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e不处理针对其他对象的权限。\u003c/p\u003e\u003cp\u003e由这些角色拥有的数据库和表空间不会被移除。\u003c/p\u003e\u003cp\u003e更多讨论请见\u003ca href=\"/docs/18/role-removal.html\" title=\"21.4. 删除角色\"\u003e第 21.4 节\u003c/a\u003e。\u003c/p\u003e","key":"notes","title":"注解"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e命令是\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e扩展。\u003c/p\u003e","key":"compatibility","title":"兼容性"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/reassign-owned/?v=18\" title=\"REASSIGN OWNED\"\u003e\u003cspan class=\"refentrytitle\"\u003eREASSIGN OWNED\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-role/?v=18\" title=\"DROP ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP ROLE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"另见"}],"sections_same_as":"","synopsis_html":"DROP OWNED BY { \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]","synopsis_text":"DROP OWNED BY { name | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.2","8.3","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}
