pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
send password to pg_dump
2+ messages / 2 participants
[nested] [flat]

* send password to pg_dump
@ 2007-01-21 08:28 shaunc <shaun@cranedata.us>
  2007-01-22 22:34 ` Re: send password to pg_dump Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 1 reply; 2+ messages in thread

From: shaunc @ 2007-01-21 08:28 UTC (permalink / raw)
  To: pgsql-hackers


Hello,

I'm trying to run pg_dump programmatically, and I'm wondering how I can send
it a password.

I'm running it with a system() call in a child process, and sending the
password in from the parent process on stdin, but somehow pg_dump always
finds out how to ask my terminal for a password. How do I fool it?

(I need this to work in linux... in python would be preferable too.)

Thanks for any advice.

- Shaun
-- 
View this message in context: http://www.nabble.com/send-password-to-pg_dump-tf3048210.html#a8473174
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: send password to pg_dump
  2007-01-21 08:28 send password to pg_dump shaunc <shaun@cranedata.us>
@ 2007-01-22 22:34 ` Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Andrew Dunstan @ 2007-01-22 22:34 UTC (permalink / raw)
  To: shaunc <shaun@cranedata.us>; +Cc: pgsql-hackers

shaunc wrote:
> Hello,
>
> I'm trying to run pg_dump programmatically, and I'm wondering how I can send
> it a password.
>
> I'm running it with a system() call in a child process, and sending the
> password in from the parent process on stdin, but somehow pg_dump always
> finds out how to ask my terminal for a password. How do I fool it?
>
> (I need this to work in linux... in python would be preferable too.)
>
>
>   

1. this is the wrong forum for this question - here we discuss 
postgresql developments, not usage
2. use a pgpass file, possibly with a PGPASSFILE environment setting as 
well - see the docs for details. This works on all platforms and should 
work with anything at all calling pg_dump.
3. In general, the only way to "fool" programs properly this way is to 
use expect or some equivalent that uses ptys. In this case, it would be 
overkill.

cheers

andrew



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-01-22 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-01-21 08:28 send password to pg_dump shaunc <shaun@cranedata.us>
2007-01-22 22:34 ` Andrew Dunstan <andrew@dunslane.net>

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