Re: dumping a password-protected db from a perl script or

From: dima <_pppp(at)mail(dot)ru>
To: Artur Pietruk <arturp(at)plukwa(dot)pdi(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: dumping a password-protected db from a perl script or
Date: 2002-11-04 15:18:46
Message-ID: 3DC68FD6.5060504@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>>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.

This doesn't work on my 7.2.1 installation :/
I need to run pg_dump actually.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ben Kassel 2002-11-04 18:21:31 AutoIncrement not working
Previous Message Artur Pietruk 2002-11-04 15:12:05 Re: dumping a password-protected db from a perl script or a binary