DROP MATERIALIZED VIEW

用于删除物化视图的 SQL 命令

DROP MATERIALIZED VIEW 是用于删除物化视图的 DDL 命令。

DROP MATERIALIZED VIEWPostgreSQL 9.3 中添加。

更改历史记录

DROP MATERIALIZED VIEW 从在 PostgreSQL 9.3 中添加以来一直没有修改。

示例

DROP MATERIALIZED VIEW 的基本用法示例

postgres=# DROP MATERIALIZED VIEW bar;
DROP MATERIALIZED VIEW

尝试删除具有依赖项的物化视图

postgres=# DROP MATERIALIZED VIEW bar;
ERROR:  cannot drop materialized view bar because other objects depend on it
DETAIL:  materialized view bar2 depends on materialized view bar
HINT:  Use DROP ... CASCADE to drop the dependent objects too.

尝试删除不存在的物化视图

postgres=# DROP MATERIALIZED VIEW boo;
ERROR:  materialized view "boo" does not exist

尝试在不是物化视图的对象上执行 DROP MATERIALIZED VIEW

postgres=# DROP MATERIALIZED VIEW foo;
ERROR:  "foo" is not a materialized view
HINT:  Use DROP TABLE to remove a table.

分类

DDLSQL 命令

另请参阅

创建物化视图修改物化视图

反馈

提交任何关于 "DROP MATERIALIZED VIEW" 的评论、建议或更正 此处