Answer the question
In order to leave comments, you need to log in
How to rename postgresql database?
Hello!
Can you please tell me how to rename the postgresql database? Tried in pgadmin - must be owner of database. Did through the console ALTER DATABASE name RENAME TO newname nothing happened.
Answer the question
In order to leave comments, you need to log in
You are doing something wrong.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+------------+------------+-----------------------
test | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
postgres=# alter database test rename to test1;
ALTER DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+------------+------------+-----------------------
test1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question