{"Entry":{"collection":"sql","key":"reassign-owned","name":"REASSIGN OWNED","aliases":["reassign-owned"],"metadata":{"aliases":["reassign-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.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes","see_also"],"removed":[]},"status":"changed","synopsis":null,"to":"9.0"},{"from":"9.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","notes","compatibility"],"removed":[]},"status":"changed","synopsis":null,"to":"9.1"},{"from":"9.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","notes"],"removed":[]},"status":"changed","synopsis":null,"to":"9.3"},{"from":"9.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":null,"to":"9.4"},{"from":"9.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["REASSIGN OWNED BY { old_role | CURRENT_USER | SESSION_USER } [, ...]","TO { new_role | CURRENT_USER | SESSION_USER }"],"removed":[]},"to":"9.5"},{"from":"9.5","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":null,"to":"9.6"},{"from":"10","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":null,"to":"11"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["notes"],"removed":[]},"status":"changed","synopsis":{"added":["REASSIGN OWNED BY { old_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]","TO { new_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER }"],"removed":[]},"to":"14"},{"from":"16","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["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":"dab708c77c6a233e7574b625f8bccd311f4c7a929f66bd5d52cad51c73decaa4","derived_content_hash":"c3b7f437641b946a1cdc8a11551bfb59166030c4a14392d366c19847c4bc2078","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:21d8d8480038e0cdb4cebd5567f1515f29b7f0bf0ca955f6b2870eb7e542d37d","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"editorial":{},"first_version":"8.2","group":"role","imported_at":"2026-09-30T17:43:38.104036+08:00","last_version":"20","name":"REASSIGN OWNED","object":"OWNED","position":5008,"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":"change the ownership of database objects owned by a database role","purpose_zh":"","related":["drop-owned","drop-role","alter-database"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:c86a0ec22378048da7b459314d512869a26aaab052fdc22d28a934f5462508e5","receipt_sha256":"b4da53dcd34d2e5db2273c59baf514d155b770212018e9012d69491fb287de12","repair":"wiki-repair-20261023"},"slug":"reassign-owned","source_rev":"wiki-repair-20261023:21d8d8480038e0cdb4cebd5567f1515f29b7f0bf0ca955f6b2870eb7e542d37d","synopsis":"REASSIGN OWNED BY { old_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]\nTO { new_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER }","verb":"REASSIGN"}},"Definition":{"Collection":"sql","Key":"reassign-owned","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"reassign-owned","SourceRevision":"wiki-repair-20261023:21d8d8480038e0cdb4cebd5567f1515f29b7f0bf0ca955f6b2870eb7e542d37d","Facts":{"anchor":"SQL-REASSIGN-OWNED","description_zh":"更改一个数据库角色所拥有的数据库对象的所有权","description_zh_html":"\u003cpre\u003eREASSIGN OWNED BY { old_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]\nTO { new_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e 指示系统将任何\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_roles\u003c/code\u003e\u003c/em\u003e 所拥有的数据库对象的所有权更改为\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-REASSIGN_OWNED-VARLISTENTRY-1\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_role\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      一个角色的名称。该角色在当前数据库中拥有的所有对象，以及该角色拥有的所有共享对象（数据库、表空间）的所有权，都将被重新分配给\n      \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-REASSIGN_OWNED-VARLISTENTRY-2\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\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=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e 常用于为移除一个或多个角色做准备。由于 \u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e 不会影响其他数据库中的对象，因此通常需要在每个包含待移除角色所拥有对象的数据库中执行此命令。\n  \u003c/p\u003e\u003cp\u003e\n   你必须具备逐个执行 \u003ccode class=\"literal\"\u003eALTER ... OWNER TO\u003c/code\u003e 所要求的全部权限。与 \u003ccode class=\"literal\"\u003eALTER TABLE ... OWNER TO\u003c/code\u003e、\u003ccode class=\"literal\"\u003eALTER TYPE ... OWNER TO\u003c/code\u003e 以及其他关系和类型的所有权变更不同，此命令不要求目标角色对对象所在的模式具有 \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e 权限。\n  \u003c/p\u003e\u003cp\u003e\n\u003ca class=\"link\" href=\"/zh/docs/18/sql-drop-owned.html\" title=\"DROP OWNED\"\u003e\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e\u003c/a\u003e 命令提供了另一种选择，它会直接删除一个或多个角色所拥有的全部数据库对象。\n  \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e 命令不会影响授予\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_roles\u003c/code\u003e\u003c/em\u003e 的、在非其所拥有的对象上的任何权限。同样，它也不会影响使用 \u003ccode class=\"command\"\u003eALTER DEFAULT PRIVILEGES\u003c/code\u003e 创建的默认权限。如需撤销这类权限，请使用 \u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e。\n  \u003c/p\u003e\u003cp\u003e\n   更多讨论请见\u003ca class=\"xref\" href=\"/zh/docs/18/role-removal.html\" title=\"21.4. 删除角色\"\u003e第 21.4 节\u003c/a\u003e。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e 命令是\n   \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-drop-owned.html\" title=\"DROP OWNED\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP OWNED\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-droprole.html\" title=\"DROP ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP ROLE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER DATABASE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","documentation_revision":{"inputs":[{"file":"sql-reassign-owned.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"c77348140ef75a6bf143e8497025ac3f0e8827e1810df53cd1c02d128c1e2a96","version":"18.7"},{"file":"sql-reassign-owned.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"d1e37c9ee7fb375c08cbe62940f0737cc68a272e38d8cc8b25d4d7cb51dc667e","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"file":"sql-reassign-owned.html","lang":"en","name":"REASSIGN OWNED","purpose":"change the ownership of database objects owned by a database role","purpose_zh":"更改一个数据库角色所拥有的数据库对象的所有权","related":["drop-owned","drop-role","alter-database"],"sections":[{"html":"\u003cp\u003e\n\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e instructs the system to change\n   the ownership of database objects owned by any of the\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_roles\u003c/code\u003e\u003c/em\u003e to\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e.\n  \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\u003eold_role\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      The name of a role. The ownership of all the objects within the\n      current database, and of all shared objects (databases, tablespaces),\n      owned by this role will be reassigned to\n      \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      The name of the role that will be made the new owner of the\n      affected objects.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003e\n\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e is often used to prepare for the\n   removal of one or more roles. Because \u003ccode class=\"command\"\u003eREASSIGN\n   OWNED\u003c/code\u003e does not affect objects within other databases,\n   it is usually necessary to execute this command in each database\n   that contains objects owned by a role that is to be removed.\n  \u003c/p\u003e\u003cp\u003e\n   You must have every privilege that an individual \u003ccode class=\"literal\"\u003eALTER ... OWNER\n   TO\u003c/code\u003e would require you to have.  Unlike \u003ccode class=\"literal\"\u003eALTER TABLE\n   ... OWNER TO\u003c/code\u003e, \u003ccode class=\"literal\"\u003eALTER TYPE ... OWNER TO\u003c/code\u003e, and\n   other relation and type ownership changes, this does not require the target\n   role to have \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e privilege on the containing schema.\n  \u003c/p\u003e\u003cp\u003e\n   The \u003ca class=\"link\" href=\"/docs/18/sql-drop-owned.html\" title=\"DROP OWNED\"\u003e\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e\u003c/a\u003e command is an alternative that\n   simply drops all the database objects owned by one or more roles.\n  \u003c/p\u003e\u003cp\u003e\n   The \u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e command does not affect any\n   privileges granted to\n   the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_roles\u003c/code\u003e\u003c/em\u003e on objects\n   that are not owned by them.  Likewise, it does not affect default\n   privileges created with \u003ccode class=\"command\"\u003eALTER DEFAULT PRIVILEGES\u003c/code\u003e.\n   Use \u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e to revoke such privileges.\n  \u003c/p\u003e\u003cp\u003e\n   See \u003ca class=\"xref\" href=\"/docs/18/role-removal.html\" title=\"21.4. Dropping Roles\"\u003eSection 21.4\u003c/a\u003e for more discussion.\n  \u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003e\n   The \u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e command is a\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\n  \u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/sql-drop-owned.html\" title=\"DROP OWNED\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP OWNED\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/sql-droprole.html\" title=\"DROP ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP ROLE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER DATABASE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"REASSIGN OWNED BY { \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_role\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]\n               TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER }","synopsis_text":"REASSIGN OWNED BY { old_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]\nTO { new_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER }","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-reassign-owned.html","sha256":"a1916ba654480e47f77c0c09d9d5f000ab47134acbb686612d51e2f8ea08614c"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-manual"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"reassign-owned","SourceDatabase":"center","Version":"18","Locale":"en","Title":"REASSIGN OWNED","Summary":"change the ownership of database objects owned by a database role","BodyHTML":"\u003cpre\u003eREASSIGN OWNED BY { old_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]\nTO { new_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\n\u003ccode\u003eREASSIGN OWNED\u003c/code\u003e instructs the system to change\n   the ownership of database objects owned by any of the\n   \u003cem\u003e\u003ccode\u003eold_roles\u003c/code\u003e\u003c/em\u003e to\n   \u003cem\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e.\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003eold_role\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      The name of a role. The ownership of all the objects within the\n      current database, and of all shared objects (databases, tablespaces),\n      owned by this role will be reassigned to\n      \u003cem\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      The name of the role that will be made the new owner of the\n      affected objects.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eNotes\u003c/h2\u003e\u003cp\u003e\n\u003ccode\u003eREASSIGN OWNED\u003c/code\u003e is often used to prepare for the\n   removal of one or more roles. Because \u003ccode\u003eREASSIGN\n   OWNED\u003c/code\u003e does not affect objects within other databases,\n   it is usually necessary to execute this command in each database\n   that contains objects owned by a role that is to be removed.\n  \u003c/p\u003e\u003cp\u003e\n   You must have every privilege that an individual \u003ccode\u003eALTER ... OWNER\n   TO\u003c/code\u003e would require you to have.  Unlike \u003ccode\u003eALTER TABLE\n   ... OWNER TO\u003c/code\u003e, \u003ccode\u003eALTER TYPE ... OWNER TO\u003c/code\u003e, and\n   other relation and type ownership changes, this does not require the target\n   role to have \u003ccode\u003eCREATE\u003c/code\u003e privilege on the containing schema.\n  \u003c/p\u003e\u003cp\u003e\n   The \u003ca href=\"/docs/18/sql-drop-owned.html\" title=\"DROP OWNED\" rel=\"nofollow\"\u003e\u003ccode\u003eDROP OWNED\u003c/code\u003e\u003c/a\u003e command is an alternative that\n   simply drops all the database objects owned by one or more roles.\n  \u003c/p\u003e\u003cp\u003e\n   The \u003ccode\u003eREASSIGN OWNED\u003c/code\u003e command does not affect any\n   privileges granted to\n   the \u003cem\u003e\u003ccode\u003eold_roles\u003c/code\u003e\u003c/em\u003e on objects\n   that are not owned by them.  Likewise, it does not affect default\n   privileges created with \u003ccode\u003eALTER DEFAULT PRIVILEGES\u003c/code\u003e.\n   Use \u003ccode\u003eDROP OWNED\u003c/code\u003e to revoke such privileges.\n  \u003c/p\u003e\u003cp\u003e\n   See \u003ca href=\"/docs/18/role-removal.html\" rel=\"nofollow\"\u003eSection 21.4\u003c/a\u003e for more discussion.\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003e\n   The \u003ccode\u003eREASSIGN OWNED\u003c/code\u003e command is a\n   \u003cspan\u003ePostgreSQL\u003c/span\u003e extension.\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/sql-drop-owned.html\" title=\"DROP OWNED\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP OWNED\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-droprole.html\" title=\"DROP ROLE\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP ROLE\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\" rel=\"nofollow\"\u003e\u003cspan\u003eALTER DATABASE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:21d8d8480038e0cdb4cebd5567f1515f29b7f0bf0ca955f6b2870eb7e542d37d","ContentHash":"b9358c2ef23c41852a5a750bc3593d7877af8d5ee303adfff4d656219169ae2a","Payload":{"related":["drop-owned","drop-role","alter-database"],"sections":[{"html":"\u003cp\u003e\n\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e instructs the system to change\n   the ownership of database objects owned by any of the\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_roles\u003c/code\u003e\u003c/em\u003e to\n   \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e.\n  \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\u003eold_role\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      The name of a role. The ownership of all the objects within the\n      current database, and of all shared objects (databases, tablespaces),\n      owned by this role will be reassigned to\n      \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e.\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      The name of the role that will be made the new owner of the\n      affected objects.\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003e\n\u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e is often used to prepare for the\n   removal of one or more roles. Because \u003ccode class=\"command\"\u003eREASSIGN\n   OWNED\u003c/code\u003e does not affect objects within other databases,\n   it is usually necessary to execute this command in each database\n   that contains objects owned by a role that is to be removed.\n  \u003c/p\u003e\u003cp\u003e\n   You must have every privilege that an individual \u003ccode class=\"literal\"\u003eALTER ... OWNER\n   TO\u003c/code\u003e would require you to have.  Unlike \u003ccode class=\"literal\"\u003eALTER TABLE\n   ... OWNER TO\u003c/code\u003e, \u003ccode class=\"literal\"\u003eALTER TYPE ... OWNER TO\u003c/code\u003e, and\n   other relation and type ownership changes, this does not require the target\n   role to have \u003ccode class=\"literal\"\u003eCREATE\u003c/code\u003e privilege on the containing schema.\n  \u003c/p\u003e\u003cp\u003e\n   The \u003ca class=\"link\" href=\"/docs/18/sql-drop-owned.html\" title=\"DROP OWNED\"\u003e\u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e\u003c/a\u003e command is an alternative that\n   simply drops all the database objects owned by one or more roles.\n  \u003c/p\u003e\u003cp\u003e\n   The \u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e command does not affect any\n   privileges granted to\n   the \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_roles\u003c/code\u003e\u003c/em\u003e on objects\n   that are not owned by them.  Likewise, it does not affect default\n   privileges created with \u003ccode class=\"command\"\u003eALTER DEFAULT PRIVILEGES\u003c/code\u003e.\n   Use \u003ccode class=\"command\"\u003eDROP OWNED\u003c/code\u003e to revoke such privileges.\n  \u003c/p\u003e\u003cp\u003e\n   See \u003ca class=\"xref\" href=\"/docs/18/role-removal.html\" title=\"21.4. Dropping Roles\"\u003eSection 21.4\u003c/a\u003e for more discussion.\n  \u003c/p\u003e","key":"notes","title":"Notes"},{"html":"\u003cp\u003e\n   The \u003ccode class=\"command\"\u003eREASSIGN OWNED\u003c/code\u003e command is a\n   \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e extension.\n  \u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/sql-drop-owned.html\" title=\"DROP OWNED\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP OWNED\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/sql-droprole.html\" title=\"DROP ROLE\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP ROLE\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\"\u003e\u003cspan class=\"refentrytitle\"\u003eALTER DATABASE\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"REASSIGN OWNED BY { \u003cem class=\"replaceable\"\u003e\u003ccode\u003eold_role\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]\n               TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_role\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER }","synopsis_text":"REASSIGN OWNED BY { old_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]\nTO { new_role | CURRENT_ROLE | CURRENT_USER | SESSION_USER }"}},"RequestedLocale":"en","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}
