R
R
Rinat Bakiev2015-03-05 09:51:26
PostgreSQL
Rinat Bakiev, 2015-03-05 09:51:26

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

2 answer(s)
A
Andrey Burov, 2015-03-05
@BuriK666

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 |

V
Vladimir, 2015-03-05
@rostel

";" must be placed at the end of the request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question