Re: Why is there no option -U with pg_dump?

From: mirko(at)picard(dot)inka(dot)de (Mirko Zeibig)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is there no option -U with pg_dump?
Date: 2001-11-08 13:24:03
Message-ID: j11es9.ral.ln@picard.inka.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Janning Vygen <vygen(at)gmx(dot)de> wrote:
> Why is there no option -U with pg_dump?
>
> thats the way it works on my host. but why cant i connect via pg_dump?
> i need this because every devolper gets his own database and
> sometimes a developer wants to mirror the production database. i
> tried to write a little shell script which drops and recreates your
> user databse and then uses the dump of the production database to
> create schema and fill teh rows. useful option is --no-owner to
> supress the connect statements.
>
> But i cant connect without user input. because the option -U ask for
> username and password.
Well, you could switch to the user postgres (via sudo)and then
running pg_dump out of a shellscript! I do:
sudo -u postgres /usr/bin/pg_dump
having an entry like:
mirko ALL=(postgres) NOPASSWD:/usr/bin/pg_dump
in my /etc/sudoers.

See http://freshmeat.net/projects/sudo/ for more information, I guess most
Linux-distribution install sudo by default anyway.

Regards
Mirko
--
GPG public key = http://www.zeibig.net/public_key.asc
GPG fingerprint = E85C D909 DC39 47CE 1757 BA36 4C68 41C8 BED4 5A8E

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Young 2001-11-08 13:26:58 High Availability Cluster in Conjunction with PostGres
Previous Message Antonio Fiol Bonnín 2001-11-08 12:31:10 Storing a tree