PostgreSQL 数据库不存在错误

rli*_*x57 2 postgresql

我收到“数据库不存在错误”,即使数据库存在:

postgres=# GRANT ALL PRIVILEGES ON DATABASE Owino to OdooD;
Run Code Online (Sandbox Code Playgroud)

错误:数据库“owino”不存在

Name    |  Owner   | Encoding |   Collate   |    Ctype    |    Access privileges

Owino   | dominus  | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
postgres| postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres           +
        |          |          |             |             | postgres=CTc/postgres  +
        |          |          |             |             | orokon=CTc/postgres    +
        |          |          |             |             | powerbidev=CTc/postgres+
        |          |          |             |             | odoodev=CTc/postgres
Run Code Online (Sandbox Code Playgroud)

a_h*_*ame 10

数据库是用双引号创建的,所以名称现在区分大小写,你现在被可怕的带引号的标识符困住了。"Owino"是一个不同的名字Owino

GRANT ALL PRIVILEGES ON DATABASE "Owino" to OdooD;
Run Code Online (Sandbox Code Playgroud)

根据您创建用户的方式,您可能还需要对用户名使用可怕的双引号 ( "OdooD")。

强烈建议不要在 SQL 中使用双引号。

有关更多详细信息,请参阅手册:https :
//www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS