删除模式
 
                  更新时间 2025-02-14 10:21:34
                 
 
                    最近更新时间: 2025-02-14 10:21:34
                  
 本文为您介绍如何删除模式。
 teledb=# drop schema teledb_schema_owner;
DROP SCHEMA当模式中存在对象时,则会删除失败,提示如下。
teledb=# create table teledb_schema_new.test(id int);
CREATE TABLE
teledb=# drop schema teledb_schema_new;
ERROR:  cannot drop schema teledb_schema_new because other objects depend on it
DETAIL:  table teledb_schema_new.test depends on schema teledb_schema_new
HINT:  Use DROP ... CASCADE to drop the dependent objects too.参考如下强制删除,会将模式中的对象也级联删除掉。
teledb=# drop schema teledb_schema_new cascade;
NOTICE:  drop cascades to table teledb_schema_new.test
DROP SCHEMA