Today I have a new server client in surabaya, that server used postgresql 8.4 its too old for my OpenERP server.

so i make decision to upgrade postgresql server version into 9.1.

Now if you have current database available you have to dump (you must log in root):

$ su postgres

$ pg_dumpall > dump.sql

$ exit

$ cp ~postgres/dump.sql /root/

Next you can safely remove postgresql old to the new one is 9.1 :

$ aptitude purge postgresql-8.4

$ aptitude install postgresql-9.1

Now, if successfully upgraded you can check with restart the postgresql:

$ /etc/init.d/postgresql restart

* Restarting PostgreSQL 9.1 database server            [ OK ]

See that result restart. now you have postgresql-9.1 now. If you want to restore database old you just follow this below:

$ su – postgres

$ psql < dump.sql

Great! Now you have upgrade postgresl to 9.1🙂

Source n thanks to :