select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Unsupported versions: 7.0 / 6.5 / 6.4
Historical version. PostgreSQL 6.5 reached end of support in June 2004. See the current manual for supported releases.

DROP VIEW

Name

DROP VIEW — Removes an existing view from a database
DROP VIEW name
  

Inputs

name

The name of an existing view.

Outputs

DROP

The message returned if the command is successful.

ERROR: RewriteGetRuleEventRel: rule "_RETname" not found

This message occurs if the specified view does not exist in the database.

Description

DROP VIEW drops an existing view from the database. To execute this command you must be the owner of the view.

Notes

The Postgres DROP TABLE statement also drops views.

Refer to CREATE VIEW for information on how to create views.

Usage

This command will remove the view called kinds:

DROP VIEW kinds;
  

Compatibility

SQL92

SQL92 specifies some additional capabilities for DROP VIEW:

DROP VIEW view { RESTRICT | CASCADE }
    

Inputs

RESTRICT

Ensures that only a view with no dependent views or integrity constraints can be destroyed.

CASCADE

Any referencing views and integrity constraints will be dropped as well.

Notes

At present, to remove a referenced view from a Postgres database, you must drop it explicitly.

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.