How to do pg_dump + pg_restore within Perl script?

From: Kynn Jones <kynnjo(at)gmail(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: How to do pg_dump + pg_restore within Perl script?
Date: 2010-05-10 16:58:36
Message-ID: AANLkTil86SHMcdCjVuOEam-QVEJMxXBFRbyr_7f32kVk@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I would like to replicate the following Unix pipe within a Perl script,
perhaps using DBD::Pg:

% pg_dump -Z9 -Fc -U <DB_USER> <FROM_DB> | pg_restore -v -d <TO_DB> -p
<SSH_TUNNEL_PORT> -h localhost -U <DB_USER>

Of course, I can try to use Perl's system, and the like, to run this pipe
verbatim, but I this as a last-resort approach.

Is there a more direct way?

Thanks!

~K

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Scott 2010-05-10 17:20:06 PostgreSQL 9.0 - support for RANGE value PRECEDING window functions
Previous Message Scott Marlowe 2010-05-10 16:30:51 Re: peer-to-peer replication with Postgres