ALTER VIEW
Use ALTER VIEW to:
- Rename a view.
- Change owner of a view.
Syntax
Rename
To rename a view:
ALTER VIEW <name> RENAME TO <new_name>;
| Syntax element | Description |
|---|---|
<name> |
The current name of the view. |
<new_name> |
The new name of the view. |
See also Renaming restrictions.
Change owner
To change the owner of a view:
ALTER VIEW <name> OWNER TO <new_owner_role>;
| Syntax element | Description |
|---|---|
<name> |
The name of the view you want to change ownership of. |
<new_owner_role> |
The new owner of the view. |
To change the owner of a view, you must be the current owner and have
membership in the <new_owner_role>.
Privileges
The privileges required to execute this statement are:
- Ownership of the view being altered.
- In addition, to change owners:
- Role membership in
new_owner. CREATEprivileges on the containing schema if the view is namespaced by a schema.
- Role membership in