Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7F11E4760BD for ; Mon, 4 Nov 2002 10:12:12 -0500 (EST) Received: from yoda.plukwa.net (yoda.plukwa.net [213.146.36.61]) by postgresql.org (Postfix) with ESMTP id D183E4760AA for ; Mon, 4 Nov 2002 10:12:11 -0500 (EST) Received: from arturp by yoda.plukwa.net with local (Exim 3.35 #1 (Debian)) id 188itZ-0002nr-00; Mon, 04 Nov 2002 16:12:05 +0100 Date: Mon, 4 Nov 2002 16:12:05 +0100 From: Artur Pietruk To: dima <_pppp@mail.ru> Cc: pgsql-admin@postgresql.org Subject: Re: dumping a password-protected db from a perl script or a binary Message-ID: <20021104151205.GK3354@yoda.plukwa.net> References: <3DC676F6.9060900@mail.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3DC676F6.9060900@mail.ru> User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/42 X-Sequence-Number: 6230 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 #include 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