REASSIGN_OWNED(7pg13)
okay bestie, welcome to the REASSIGN_OWNED(7pg13) page β this is the REASSIGN OWNED command from the PostgreSQL 13.23 docs, and it's giving main character energy π
π NAME π
REASSIGN_OWNED β change the ownership of database objects owned by a database role. no cap β¨
β¨ SYNOPSIS β¨
REASSIGN OWNED BY { old_role | CURRENT_USER | SESSION_USER } [, ...]
TO { new_role | CURRENT_USER | SESSION_USER }
π¦ DESCRIPTION π¦
okay so REASSIGN OWNED instructs the system to change the ownership of database objects owned by any of the old_roles to new_role. that's the whole assignment, periodt π«Ά
π PARAMETERS π
old_roleβ the name of a role. the ownership of all the objects within the current database, and of all shared objects (databases, tablespaces), owned by this role will be reassigned tonew_roleπ«new_roleβ the name of the role that will be made the new owner of the affected objects. she's the new owner, slay π
πΈ NOTES πΈ
REASSIGN OWNEDis often used to prepare for the removal of one or more roles. it's giving cleanup era π§Ή- because
REASSIGN OWNEDdoes not affect objects within other databases, it is usually necessary to execute this command in each database that contains objects owned by a role that is to be removed. yes bestie, you gotta go database by database π REASSIGN OWNEDrequires membership on both the source role(s) and the target role. both sides, no skipping π«Ά- the
DROP OWNED (DROP_OWNED(7))command is an alternative that simply drops all the database objects owned by one or more roles. different vibe, same cleanup energy π - the
REASSIGN OWNEDcommand does not affect any privileges granted to theold_roleson objects that are not owned by them. likewise, it does not affect default privileges created withALTER DEFAULT PRIVILEGES. useDROP OWNEDto revoke such privileges. important little caveat, iykyk β οΈ - see Section 21.4 for more discussion. there's more tea there β
β COMPATIBILITY β
the REASSIGN OWNED command is a PostgreSQL extension. it's a PostgreSQL original, periodt π
π SEE ALSO π
DROP OWNED (DROP_OWNED(7))DROP ROLE (DROP_ROLE(7))ALTER DATABASE (ALTER_DATABASE(7))
mwah π this iconic page is from PostgreSQL 13.23, dated 2025, and it's serving REASSIGN OWNED(7) energy β byeee bestie ππ₯
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms