PostgreSQL:删除数据库但数据库仍然存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9044379/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-20 23:34:50  来源:igfitidea点击:

PostgreSQL: Drop Database but DB is still there

postgresqlsql-drop

提问by neurix

I am new to PostgreSQL and I try to get my head around it. I am familiar to db's and MySQL.

我是 PostgreSQL 的新手,我试图了解它。我对 db 和 MySQL 很熟悉。

I am trying to delete database, which I created since psql seems to ignore the changes I try to push through Django.

我正在尝试删除我创建的数据库,因为 psql 似乎忽略了我尝试通过 Django 推送的更改。

When I execute \lI get the following response:

当我执行时,\l我得到以下响应:

                                  List of databases
       Name       | Owner  | Encoding |   Collate   |    Ctype    | Access privileges 
------------------+--------+----------+-------------+-------------+-------------------
 postgres         | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | 
 test_db          | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | 
 template0        | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | =c/neurix        +
                  |        |          |             |             | neurix=CTc/neurix
 template1        | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | =c/neurix        +
                  |        |          |             |             | neurix=CTc/neurix
 template_postgis | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | 
(5 rows)

Now I wan to drop the database "test_db" with

现在我想删除数据库“test_db”

DROP DATABASE test_db

but when I execute \lafterwards, the table is still there and the overview looks like about.

但是当我\l之后执行时,表格仍然存在,并且概述看起来像。

回答by Tom Anderson

Did you type a ;after the DROP DATABASE test_db? Did PostgreSQL print a response to your command?

你在;之后打了 aDROP DATABASE test_db吗?PostgreSQL 是否打印了对您的命令的响应?