Skip site navigation (1) Skip section navigation (2)

Re: pg_dump

From: David Saracini <dsaracini(at)yahoo(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql novice forum <pgsql-novice(at)postgresql(dot)org>
Subject: Re: pg_dump
Date: 2009-08-27 01:48:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

Thank you for the reply...  I appreciate it.

I should have noted below that I am on Windows.

Yes; the topic has been discussed several times and in several places.  And I think that I have read almost all of it (at least a major portion). 

What I would like to avoid is having the password in plain text on the disk (via a batch file, pgpass.conf, etc.).  Plus, from the documentation, using a system variable is deprecated and has security issues.  (Just a note, I never got this method to work anyway via C# and the Process class).

And yes, I do understand that if I put it in my source code, it is still on the disk.  But, that is going to be on a server (harder to get to...) and also, I can keep it in an encrypted resource and just unencrypt in memory when I need it.

BTW, I do get that this is not totally secure either.  Any security measure can be broken once the user has the exe/dll and control of the box that code is running on.  But, IMHO, it would certainly be better than that having it unencrypted on disk - or making my end user try to protect the password via Windows' file/directory security.

I guess what I'm wishing for is that pg_dumb was changed to where the password could be sent via the command line.  I've seen this requested multiple times and it's always been just rejected.  I'm not sure why.  Anyone know?  If so, could you reply?  It *seems* like a minor change.  At least it would be in my code and in C#, but...  I don't know about pg_dump/pgsql.  It might be much, much more difficult.  (???)

So, to recap, what I'm learning is that the best way to do this is to dynamically create a batch file, then exec it and get the exitcode via %errorlevel%.  Then *try* to make sure I delete it.


Thanks again for the help.


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: David Saracini <dsaracini(at)yahoo(dot)com>
Cc: pgsql novice forum <pgsql-novice(at)postgresql(dot)org>
Sent: Tuesday, August 25, 2009 6:46:27 AM
Subject: Re: [NOVICE] pg_dump

On Fri, Aug 21, 2009 at 12:58 AM, David Saracini<dsaracini(at)yahoo(dot)com> wrote:
> Ultimately, what I would like is to have my app server kick off every night
> at a configurable time and save a backup to a configurable location.  Any
> advice on how to accomplish this and do it without writing the password to
> disk?

Depends on what you mean by "without writing the password to disk" (do you not
want the password hardcoded into your source code, do you not want a
.pgpass file,
do you not want it in a crontab or .bat file -- you'll have to have
the password
*somewhere*), and on what platform you're on. If you're on Windows,
see the backup
guide here:

This topic has also been discussed in numerous other places, e.g.

- Josh

In response to

  • Re: pg_dump at 2009-08-25 13:46:27 from Josh Kupershmidt


pgsql-novice by date

Next:From: Tom LaneDate: 2009-08-27 01:52:37
Subject: Re: pg_dump
Previous:From: Shane AmblerDate: 2009-08-26 19:53:03
Subject: Re: Install new perl test function in PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group