2011-03-11 59 views
0
 
bin]# ./createdb cx123 -U postgres 
[bin]# ./createdb cx111 -U postgres 

[bin]# ./psql -d cx123 -U postgres Welcome to psql 8.3.7, the PostgreSQL interactive terminal. 

Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit 

cx123=# ALTER DATABASE cx111 RENAME TO cx222 
cx123-# \q 

[bin]# ./psql -l -U postgres 
List of databases 
Name | Owner | Encoding 
-----------+----------+---------- 
cx111 | postgres | UTF8 
cx123 | postgres | UTF8 
(2 rows) 
################################################### 

嗨,大家好,看到上面的代碼,我沒有把cx111重命名爲cx 222,任何想法?非常感謝。postgres重命名數據庫不工作

回答

3

您需要用分號終止ALTER語句。

您鍵入它的方式,它從來沒有得到執行,因爲psql正在等待語句完成。

+0

非常感謝。有效。 – Charlie 2011-03-13 23:43:12