删除模式
 
                  更新时间 2025-02-05 09:36:26
                 
 
                    最近更新时间: 2025-02-05 09:36:26
                  
 本文为您介绍如何删除模式。
 您可执行如下操作删除模式。
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
