Thread: About pg_dump

About pg_dump

From
"Aldo Vadillo Batista"
Date:
Hi everybody,
 
 
If you execute "pg_dump -u database", pg_dump permits you to specify the user who is making the dump. But then, pg_dump waits for you to insert the user name and the password.
 
I want to make automatic scripts to create the copies and I have the problem of interactive I/O.
I am using postgresql 7.1, how can I make the copies?
 
Thanks in advance.
 
Saludos,
 
     Aldo Vadillo Batista avadillo@ulpgc.es
     Subdirección de Comunicaciones - ULPGC
     Las Palmas de G.C.  –  Islas Canarias

Re: About pg_dump

From
Jason Earl
Date:
It looks like setting the PGUSER and PGPASSWORD
environment variables does the trick.  I don't know
where that is in the documentation (PGUSER is in the
psql man page, but I wasn't able to find PGPASSWORD).

So something like:

PGUSER='postgres'
PGPASSWORD='secret'
export PGUSER PGPASSWORD

pg_dump -h mydatahost mydatabase -t mytable

Seems work just like you would expect.

I hope this is helpful,
Jason

--- Aldo Vadillo Batista <avadillo@ulpgc.es> wrote:
> Hi everybody,
>
>
> If you execute "pg_dump -u database", pg_dump
> permits you to specify the user who is making the
> dump. But then, pg_dump waits for you to insert the
> user name and the password.
>
> I want to make automatic scripts to create the
> copies and I have the problem of interactive I/O.
> I am using postgresql 7.1, how can I make the
> copies?
>
> Thanks in advance.
>
> Saludos,
>
>      Aldo Vadillo Batista avadillo@ulpgc.es
>      Subdirecci�n de Comunicaciones - ULPGC
>      Las Palmas de G.C.  -  Islas Canarias
>
>


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Re: About pg_dump

From
"Thalis A. Kalfigopoulos"
Date:
On Thu, 28 Jun 2001, Jason Earl wrote:

>
> It looks like setting the PGUSER and PGPASSWORD
> environment variables does the trick.  I don't know
> where that is in the documentation (PGUSER is in the
> psql man page, but I wasn't able to find PGPASSWORD).
>
> So something like:
>
> PGUSER='postgres'
> PGPASSWORD='secret'
> export PGUSER PGPASSWORD
>
> pg_dump -h mydatahost mydatabase -t mytable
>
> Seems work just like you would expect.
>

or run a shell script:

pg_dump -u -h lalahost -t lalatab laladb <<EOF
user_name_here
password_here
EOF

and chmod the script accordingly

cheers,
thalis

> I hope this is helpful,
> Jason
>
> --- Aldo Vadillo Batista <avadillo@ulpgc.es> wrote:
> > Hi everybody,
> >
> >
> > If you execute "pg_dump -u database", pg_dump
> > permits you to specify the user who is making the
> > dump. But then, pg_dump waits for you to insert the
> > user name and the password.
> >
> > I want to make automatic scripts to create the
> > copies and I have the problem of interactive I/O.
> > I am using postgresql 7.1, how can I make the
> > copies?
> >
> > Thanks in advance.
> >
> > Saludos,
> >
> >      Aldo Vadillo Batista avadillo@ulpgc.es
> >      Subdirecci�n de Comunicaciones - ULPGC
> >      Las Palmas de G.C.  -  Islas Canarias
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


Re: About pg_dump

From
"Oliver Elphick"
Date:
Jason Earl wrote:
  >
  >It looks like setting the PGUSER and PGPASSWORD
  >environment variables does the trick.  I don't know
  >where that is in the documentation (PGUSER is in the
  >psql man page, but I wasn't able to find PGPASSWORD).
  >
  >So something like:
  >
  >PGUSER='postgres'
  >PGPASSWORD='secret'
  >export PGUSER PGPASSWORD
  >
  >pg_dump -h mydatahost mydatabase -t mytable
  >
  >Seems work just like you would expect.

However, this is not secure, because the e output format option to ps can be
used to inspect the environment, thus revealing the password.


--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "The Spirit of the Lord is upon me, because he hath
      anointed me to preach the gospel to the poor; he hath
      sent me to heal the brokenhearted, to preach
      deliverance to the captives, and recovering of sight
      to the blind, to set at liberty them that are
      bruised..."         Luke 4:18