ALTER … OWNER
ALTER ... OWNER updates the owner of an item.
Syntax
| Field | Use |
|---|---|
| name | The identifier of the item you want to alter. |
| new_owner | The role name you want to set as the new owner. |
Details
You must be a member of the new owner role to alter the ownership of an object. You cannot alter the owner of an index. If you try, it will return successfully with a warning, but will not actually change the owner of the index. This is for backwards compatibility reasons. The index owner is always kept in-sync with the owner of the underlying relation.
Examples
ALTER TABLE t OWNER TO joe;
ALTER CLUSTER REPLICA production.r1 OWNER TO admin;
Privileges
The privileges required to execute this statement are:
- Role membership in
new_owner. - Ownership of the object being altered.
CREATEprivileges on the containing cluster if the object is a cluster replica.CREATEprivileges on the containing database if the object is a schema.CREATEprivileges on the containing schema if the object is namespaced by a schema.