pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Automating pg_Dump on Windows 2016 Server
2+ messages / 2 participants
[nested] [flat]

* Automating pg_Dump on Windows 2016 Server
@ 2018-11-14 19:49  Simon White <simonwhite@dciphercomputing.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Simon White @ 2018-11-14 19:49 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Hi

Automating pg_dump seems to be unnecessarily difficult from Windows 
Server 2016.  I have tried using the PGPASSWORD environment variable and 
the PGPASSFILE environment variable all to no avail.  The result is that 
I am always prompted for a password.  Could you not create a option to 
pass the password on the command line or the location of a password file 
to be used. That certainly would make things simpler.

Since I was using the "postgres" user I tried setting the password under 
the "postgres" user in pgAdmin4 but that did not help either.

-- 
Regards,
Simon White
dCipher Computing
705-500-0191





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

* Re: Automating pg_Dump on Windows 2016 Server
@ 2018-11-14 21:59  Thomas Kellerer <spam_eater@gmx.net>
  parent: Simon White <simonwhite@dciphercomputing.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Thomas Kellerer @ 2018-11-14 21:59 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Simon White schrieb am 14.11.2018 um 20:49:
> Automating pg_dump seems to be unnecessarily difficult from Windows
> Server 2016.  I have tried using the PGPASSWORD environment variable
> and the PGPASSFILE environment variable all to no avail.  The result
> is that I am always prompted for a password.  Could you not create a
> option to pass the password on the command line or the location of a
> password file to be used. That certainly would make things simpler.
> 
> Since I was using the "postgres" user I tried setting the password
> under the "postgres" user in pgAdmin4 but that did not help either.
> 

I have no problems setting the variable inside a batch file:

   setlocal
   set PGPASSWORD=verysecret
   pg_dump -U myuser -D ....

By default Postgres uses the "Local System" account to run the service. I don't think that is a Windows user for which you can define environment variables. So you would need to define the environment variable as a global one.

If you don't want to use a batch file, you could create a dedicated Windows user where you set the environment variables and then use that user to run the service. But make sure you adjust the privilege on the data directory. Using a batch file for pg_dump is most probably a lot easier.




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


end of thread, other threads:[~2018-11-14 21:59 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 19:49 Automating pg_Dump on Windows 2016 Server Simon White <simonwhite@dciphercomputing.com>
2018-11-14 21:59 ` Thomas Kellerer <spam_eater@gmx.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