ALTER VIEW
Modifies the metadata of an existing view. The changes are auto-committed
Syntax
ALTER VIEW [schema.]view-name { ... | OWNER TO owner-name ... | SET SCHEMA schema-name ... | { INCLUDE | EXCLUDE | MATERIALIZE } [ SCHEMA ] PRIVILEGES
ALTER TABLE [schema.]view-name[,...] RENAME TO new-view-name[,...]
Parameters
schema
|
Specifies a schema. If multiple schemas are defined in the database, include the schema name. For example: myschema.thisDbObject |
view-name |
The view to alter. |
SET SCHEMA schema‑name
|
Moves the view from one schema to another. |
OWNER TO owner‑name
|
Changes the view owner. |
{ INCLUDE
|
Specifies default inheritance of schema privileges for this view:
Note: If inherited privileges are disabled at the database level, schema privileges can still be materialized. For more information see Grant Inherited Privileges. |
RENAME TO
|
Renames one or more views: RENAME TO new‑view‑name[,...]
The following requirements apply:
|
Privileges
Changing a view requires the following privileges:
- Superuser
- If renaming a view, CREATE privileges on the schema in which the view is renamed.
Example
The following command renames view1
to view2
:
=> CREATE VIEW view1 AS SELECT * FROM t; CREATE VIEW => ALTER VIEW view1 RENAME TO view2; ALTER VIEW