Contents
DROP VIEW
A DDL command for removing a view
DROP VIEW
is a DDL command for removing a view.
DROP VIEW
has always been present in PostgreSQL.
Change history
- PostgreSQL 8.2
DROP VIEW IF EXISTS ...
syntax added (commit daea4d8e)
- PostgreSQL 7.3
CASCADE
andRESTRICT
clauses added (commit 131f801d)
Examples
Basic DROP VIEW
execution:
postgres=# DROP VIEW bar; DROP VIEW
Safely attempting to drop a view which might not exist:
postgres=# DROP VIEW IF EXISTS bar; NOTICE: view "bar" does not exist, skipping DROP VIEW
Dropping a view with dependencies:
postgres=# DROP VIEW bar; ERROR: cannot drop view bar because other objects depend on it DETAIL: view baz depends on view bar HINT: Use DROP ... CASCADE to drop the dependent objects too. postgres=# DROP VIEW bar CASCADE; NOTICE: drop cascades to view baz DROP VIEW
References
- PostgreSQL documentation: DROP VIEW