Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Setup and maintain your staging environments from your production backups!
Python Shell
Failed to load latest commit information.
debian Improve packing + Makefile
pgstaging Improve packing + Makefile
sql Pgfouine : deplacé dans PostgreSQL
.gitignore Improve .gitignore
DEPENDS pg_staging: DEPENDS file, maybe will get obsoleted by a proper debian…
Makefile Improve packing + Makefile
README.rst Add an introductory README file, using the RST markup (github accepts…
TODO TODO DONE * load should use the path from the pg_staging config
bird-view.txt Add an architecture bird view showing how to setup pg_staging
pg_staging.1.txt Clarify documentation about where to place the pre and post SQL files.
pg_staging.5.txt Whitespace cleaning, M-x delete-trailing-whitespace
pg_staging.ini Fix stdin scripting
replication.ini Add config files and adapt debian packaging, change some defaults for… Improve londiste CMD detection + Loop over tables list to add in repl…



Setup and maintain your staging environments from your production backups!


pg_staging implements commands for playing with your PostgreSQL_ <> backups, allowing you to expose in devel or prelive environments more than one copy of a live database at the same time.

This document is formatted in a github_ <> supported format, unfortunately asciidoc is not one of them. So all documents are in asciidoc format except for this README.

backing up, restoring

pg_staging is all about leaveraging your backups procedures, and propose commands allowing to restore those into environments developpers are using to validate their code.

switching between multiple copies

Thanks to pgbouncer you can setup things so that psql -h devel mydb will connect to whatever you restored last, which is called mydb_YYYYMMDD, after the date the backup was taken. pg_staging supports switching


Please refer to the manual for details.

You have 3 ways to use the pg_staging commands:

  • interactive console

  • command line interface command arg1 arg2

  • scripting

    (echo 'arg1'; echo 'arg2') | pg_staging

All those interfaces expose the exact same set of commands, use the one best fitting your usage environment.

Please note that the scripting .pgs support is pretty limited currently, it lets you get and set configuration and run the usual commands.


The setup is to be handled in .ini files, where you describe your target environment in terms of the production one. Basically you tell pg_staging where to find your backups and restore them.

Something went wrong with that request. Please try again.