12th September 2019: PostgreSQL 12 Beta 4 Released!
Supported Versions: Current (11) / 10 / 9.6 / 9.5 / 9.4
Development Versions: 12 / devel
Unsupported versions: 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the supported versions listed above instead.

ALTER VIEW

Name

ALTER VIEW -- change the definition of a view

Synopsis

ALTER VIEW name RENAME TO newname

Description

ALTER VIEW changes the definition of a view. The only currently available functionality is to rename the view. To execute this command you must be the owner of the view.

Parameters

name

The name (optionally schema-qualified) of an existing view.

newname

The new name of the view.

Notes

Some variants of ALTER TABLE can be used with views as well; for example, to rename a view it is also possible to use ALTER TABLE RENAME. To change the schema or owner of a view, you currently must use ALTER TABLE.

Examples

To rename the view foo to bar:

ALTER VIEW foo RENAME TO bar;

Compatibility

ALTER VIEW is a PostgreSQL extension of the SQL standard.