I am getting a "database does not exist error", even when the database exists:
postgres=# GRANT ALL PRIVILEGES ON DATABASE Owino to OdooD;
ERROR: database "owino" does not exist
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
2 Answers 2
The database was created with double quotes, so the name is now case-sensitive and you are now stuck with the dreaded quoted identifiers. "Owino"
is a different name than Owino
GRANT ALL PRIVILEGES ON DATABASE "Owino" to OdooD;
Depending on how you created the user, you might need to use the dreaded double quotes for the user name as well ("OdooD"
).
I highly recommend to simply never use double quotes in SQL.
See the manual for more details:
https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
Dont use mixed case database names, there are several applications that will have problems with this
Owino is mixed case
The answer above imples that you created the database name using " ".
I have encountered this issue when I created a database name without " ", just using a mixed case name like MyDatabase
-
2What does this add to the other answer?Evan Carroll– Evan Carroll2017年09月12日 01:45:34 +00:00Commented Sep 12, 2017 at 1:45
-
1The advice is good, but it is indeed not an answer to the problem presented.user1822– user18222017年09月12日 06:00:21 +00:00Commented Sep 12, 2017 at 6:00