tags:

views:

1147

answers:

4

Hi, Could anybody help me to rename database in postgresql from the Linux shell

" ALTER DATABASE name RENAME TO newname "
The above statement doesn't execute

+1  A: 

You might need priviliges to renmae db. Only db owner or super user can do that, owner also needs a createdb priv.

Also the database you're connected to cannot be renamed, you need to connect to a different one

CountZero
+2  A: 

Which version of PostreSql? From the 8.1 Documentation:

ALTER DATABASE name RENAME TO newname

Only the database owner or a superuser can rename a database; non-superuser owners must also have the CREATEDB privilege. The current database cannot be renamed. (Connect to a different database if you need to do that.)

GaZ
A: 

Did you terminate your statement with a semicolon?

lfaraone