DROP MATERIALIZED VIEW
是用于删除物化视图的DDL命令。
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.
参考文献
- PostgreSQL 文档: DROP MATERIALIZED VIEW