DROP VIEW

删除视图的 SQL 命令

DROP VIEW 是一个用于删除视图的 DDL(数据定义语言)命令。

DROP VIEW 命令一直存在于 PostgreSQL 中。

变更历史

示例

基本的 DROP VIEW 执行

postgres=# DROP VIEW bar;
DROP VIEW

安全地尝试删除可能不存在的视图

postgres=# DROP VIEW IF EXISTS bar;
NOTICE:  view "bar" does not exist, skipping
DROP VIEW

删除带有依赖关系的视图

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

分类

DDL, SQL 命令

另请参阅

CREATE VIEW, ALTER VIEW, DROP MATERIALIZED VIEW

反馈

提交对“DROP VIEW”的任何评论、建议或更正,请在此处 提交