postgres重命名数据库无法正常工作

1 postgresql

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,任何想法?非常感谢.

a_h*_*ame 6

您需要使用分号终止ALTER语句.

你输入它的方式,它永远不会被执行,因为psql正在等待语句完成.