From: Artur Pietruk <arturp@plukwa.pdi.net>
To: dima <_pppp@mail.ru>
Cc: pgsql-admin@postgresql.org
Subject: Re: dumping a password-protected db from a perl script or a binary
Date: Mon, 4 Nov 2002 16:12:05 +0100
Message-ID: <20021104151205.GK3354@yoda.plukwa.net> (raw)
In-Reply-To: <3DC676F6.9060900@mail.ru>
References: <3DC676F6.9060900@mail.ru>
On Mon, Nov 04, 2002 at 04:32:38PM +0300, dima wrote:
> How can i dump a password-protected database using perl (DBI or pg) or C
> (using libpq)? I can't pass the password to pg_dump utility (I was
> trying to pass it via tty also) when running system() from perl.
Isn't example below something like what you are trying to do:
====8<====
#include <stdio.h>
#include <stdlib.h>
int main(void) {
system("export PGDATABASE=\"test\"; export PGPASSWORD=\"test\"; export PGUSER=\"test\"; psql");
exit(0);
}
====8<====
? Here psql should connect to db 'test' as user 'test', password
'test'. Check if it works with pg_dump.
I hope that helps! BTW - there are also other ways to do that...
Check docs of your pg version. $PGPASSWORD is deprecated.
Best regards,
--
--- Artur Pietruk, arturp@plukwa.net
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: arturp@plukwa.pdi.net, _pppp@mail.ru
Subject: Re: dumping a password-protected db from a perl script or a binary
In-Reply-To: <20021104151205.GK3354@yoda.plukwa.net>
References: <3DC676F6.9060900@mail.ru> <20021104151205.GK3354@yoda.plukwa.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox