-- 删除数据库teledb_db_new
teledb=# drop database teledb_db_new;
-- 仍有会话连接数据库时,会报错
ERROR: database "teledb_db_new" is being accessed by other users
DETAIL: There is 1 other session using the database.
-- 停止该数据库的所有连接,后重新删除数据库
teledb=# select pg_terminate_backend(pid) from pg_stat_activity where datname='teledb_db_new';
pg_terminate_backend
----------------------
t
(1 row)
teledb=# drop database teledb_db_new;
DROP DATABASE