删除物化视图

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

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

DROP MATERIALIZED VIEW 添加于 PostgreSQL 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”的评论、建议或更正 此处