pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Automating pg_Dump on Windows 2016 Server
Date: Wed, 14 Nov 2018 22:59:17 +0100
Message-ID: <d1587115-7566-aad6-050d-50671ed018e7@gmx.net> (raw)
In-Reply-To: <c2e04be9-3bbb-a575-190b-c8733efaaad1@dciphercomputing.com>
References: <c2e04be9-3bbb-a575-190b-c8733efaaad1@dciphercomputing.com>

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.




view thread (2+ messages)

Message-ID: <d1587115-7566-aad6-050d-50671ed018e7@gmx.net>
Permalink:  ../d1587115-7566-aad6-050d-50671ed018e7@gmx.net/
Also on:    postgresql.org/message-id/d1587115-7566-aad6-050d-50671ed018e7@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: Automating pg_Dump on Windows 2016 Server
  In-Reply-To: <d1587115-7566-aad6-050d-50671ed018e7@gmx.net>
  References: <c2e04be9-3bbb-a575-190b-c8733efaaad1@dciphercomputing.com> <d1587115-7566-aad6-050d-50671ed018e7@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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