Pg dump when upgrading PostgreSQL

From Glom
Revision as of 15:34, 23 November 2010 by Isijujemiru (Talk | contribs)

Jump to: navigation, search

This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page


Using pg_dump when upgrading PostgreSQL

NOTE: Since Glom 1.14.4, the Developer menu has an Export Backup option, making these instructions unnecessary. These instructions are obviously very awkward, but this information is only here for people who need to create a backup from Glom versions older than 1.14.4, for use by Glom versions since 1.14.4.

Manually exporting the old database =

On a computer with the old PostgreSQL version:

  • Open the .glom file so you can see the data in Glom.
  • Create a directory for the backup file, such as ~/mybackup/ .
  • Create a glom_postgres_data/ directory under it. For intance, ~/mybackup/glom_postgres_data/ .
  • Discover the port number. For instance, in the terminal, this tells us that the port is 5434:
[murrayc@murrayc-desktop ~]$ ps -ef | grep "glom_postgres_data"
murrayc   2800  2733  0 15:53 ?        00:00:00 /usr/lib/postgresql/8.3/bin/postgres -D /home/murrayc/testpg8p3music/glom_postgres_data/data -p 5434 -i -c hba_file=/home/murrayc/testpg8p3music/glom_postgres_data/config/pg_hba.conf -c ident_file=/home/murrayc/testpg8p3music/glom_postgres_data/config/pg_ident.conf -k /home/murrayc/testpg8p3music/glom_postgres_data --external_pid_file=/home/murrayc/testpg8p3music/glom_postgres_data/pid
  • Discover the database name by looking at the first second line of the .glom file. For instance, this tells us that the database name is glom_film_production_manager
<connection server="localhost" user="" database="glom_film_production_manager" self_hosted="true" port="5434" try_other_ports="false" hosting_mode="postgres_self"/>
  • Use pg_dump, like so, entering glom_default_developer_password when prompted for the password:
[murrayc@murrayc-desktop ~]$ /usr/lib/postgresql/8.4/bin/pg_dump --create --file=~/mybackup/glom_postgres_data/backup --username=glom_default_developer_user --host=localhost --port=5434 glom_film_production_manager

(copy the command and the password from this web page and paste it into the terminal to be sure. You'll need your own special username and password if you have enabled network sharing. You can use the newer version of pg_dump.) (Developers: That default username/password is from

  • Copy your original .glom file into the directory, for instance ~/mybackup/mybackup.glom .
  • Edit that mybackup.glom file and add an is_backup="true" attribute to the glom_document node. For instance:
 <glom_document xmlns="" translation_original_locale="en_US" database_title="Music Collection" is_example="false" format_version="5" is_backup="true">
  • Create a tarball of the directory, like so:
 cd ~
 tar -czf mybackup.tar.gz mybackup 

Importing as a new database

Since Glom 1.14.4, the Developer menu has a Restore Backup option, which allows you to choose an existing .tar.gz file to restore. For instance:

 glom --restore mybackup.tar.gz