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

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

Categories

DDL

See also

CREATE VIEW, ALTER VIEW