DROP VIEW

Drop a view from a database.

DROP VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
IF EXISTS
Do not return a warning if the view does not exist.
name
Name the view to drop, optionally qualified by its schema name. You can drop multiple views with one statement.
CASCADE
If other objects depend on the view, such as other views, drop them as well.
RESTRICT
If other objects depend on the view, do not drop the view. This is the default.
For example, drop a view called matchview:
premdb=# drop view matchview;
DROP VIEW
For example, restrict a view from being dropped if it has dependencies:
premdb=# create view depview as select * from valuesview where id1=0;
CREATE VIEW
premdb=# drop view valuesview restrict;
ERROR:  cannot drop view valuesview because other objects depend on it
DETAIL:  view depview depends on view valuesview
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
For example, note the use of the IF EXISTS option in the second statement (no error message is returned):
premdb=# drop view myview;
ERROR:  view "myview" does not exist
premdb=# drop view if exists myview;
DROP VIEW