Skip to content

Temporarily run postgres against a pre-existing data directory while you run a command

Notifications You must be signed in to change notification settings

purcell/with-temp-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

with-temp-postgres

This is a handy script for temporarily running postgresql while you execute a command: the DB is started against the specified data directory (which must already exist), then the command is run, and finally the DB is stopped again.

The DB listens only on a domain socket, and appropriate values of the standard PG* environment variables are set while running the specified command such that it will use that connection.

In conjunction with Nix, for example, this can be used to access data from old DB installations, e.g.

nix-shell -p postgresql_9_6 --run "./with-temp-postgres /usr/local/var/postgres-9.6 psql -l"

About

Temporarily run postgres against a pre-existing data directory while you run a command

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages