Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 0A978475CE5 for ; Mon, 4 Nov 2002 10:19:04 -0500 (EST) Received: from mx9.mail.ru (mx9.mail.ru [194.67.57.19]) by postgresql.org (Postfix) with ESMTP id D2596475CC4 for ; Mon, 4 Nov 2002 10:19:02 -0500 (EST) Received: from drweb by mx9.mail.ru with drweb-scanned (Exim MX.9) id 188j0L-000Orf-00; Mon, 04 Nov 2002 18:19:05 +0300 Received: from [213.128.193.142] (helo=mail.ru) by mx9.mail.ru with esmtp (Exim SMTP.9) id 188j07-000OZY-00; Mon, 04 Nov 2002 18:18:51 +0300 Message-ID: <3DC68FD6.5060504@mail.ru> Date: Mon, 04 Nov 2002 18:18:46 +0300 From: dima <_pppp@mail.ru> User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0.0) Gecko/20020816 X-Accept-Language: ru, en-us, en MIME-Version: 1.0 To: Artur Pietruk Cc: pgsql-admin@postgresql.org Subject: Re: dumping a password-protected db from a perl script or References: <3DC676F6.9060900@mail.ru> <20021104151205.GK3354@yoda.plukwa.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/43 X-Sequence-Number: 6231 >>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. This doesn't work on my 7.2.1 installation :/ I need to run pg_dump actually.