postgres 重命名数据库不起作用
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,知道吗?多谢。
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) ###################################################
Hi guys, See the above code, I failed to rename cx111 to cx 222, any idea? Thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要用分号终止 ALTER 语句。
按照您输入的方式,它从未被执行,因为 psql 正在等待语句完成。
You need to terminate the ALTER statement with a semicolon.
The way you typed it, it never got executed because psql was waiting for the statement to be finished.