small pg_dump RFE: new --no-prompt (password) option
I'm forwarding this on behalf of Marc Hebert
Show quoted text
Hi there,
As discussed recently on the jdbc mailing-list in this "Backup in
Java" thread<http://thread.gmane.org/gmane.comp.db.postgresql.jdbc/12441/
focus=12441>there is a significant interest in doing backups in an
non-interactive, programmatic way. Reminder: AFAIK pg_dump is
currently the very unique reliable way to perform a backup. There
is no
documented API or protocol to do this. Any program in any language is
stuck with "scripting" pg_dump.When we implemented this scripting in Java we faced one major issue:
pg_dump may prompt for a password in a unpredictable way (depending on
the user misconfiguration). Taking care of this is surprisingly
complex. The suggested --no-prompt would make scripting pg_dump
infinitely easier. In case a password is needed, this option would
simply fail and return immediatly with an appropriate error message.
Or even better, with a well-defined return status.Thanks in advance for considering this new feature!
Sincerely,
Marc.
Import Notes
Reference msg id not found: 20061201092056.GA16927@continuent.com
On Fri, Dec 01, 2006 at 07:46:59AM -0500, Dave Cramer wrote:
I'm forwarding this on behalf of Marc Hebert
I saw it the first time.
When we implemented this scripting in Java we faced one major issue:
pg_dump may prompt for a password in a unpredictable way (depending on
the user misconfiguration). Taking care of this is surprisingly
complex. The suggested --no-prompt would make scripting pg_dump
infinitely easier. In case a password is needed, this option would
simply fail and return immediatly with an appropriate error message.
Or even better, with a well-defined return status.
Seems to me that you could just do this by setting stdin to be
/dev/null?
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
From each according to his ability. To each according to his ability to litigate.
On 1-Dec-06, at 8:13 AM, Martijn van Oosterhout wrote:
On Fri, Dec 01, 2006 at 07:46:59AM -0500, Dave Cramer wrote:
I'm forwarding this on behalf of Marc Hebert
I saw it the first time.
Sorry about the double posting
When we implemented this scripting in Java we faced one major issue:
pg_dump may prompt for a password in a unpredictable way
(depending on
the user misconfiguration). Taking care of this is surprisingly
complex. The suggested --no-prompt would make scripting pg_dump
infinitely easier. In case a password is needed, this option would
simply fail and return immediatly with an appropriate error message.
Or even better, with a well-defined return status.Seems to me that you could just do this by setting stdin to be
/dev/null?
I think a well defined error message makes sense.
Show quoted text
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/
kleptog/From each according to his ability. To each according to his
ability to litigate.
Seems to me that you could just do this by setting stdin to be
/dev/null?I think a well defined error message makes sense.
I would think the OP doesn't care that much about the message itself but
about the fact that the thing is left hanging and never returns. In the
presence of such a flag pg_dump should never try to prompt for a
password but fail immediately and exit.
Cheers,
Csaba.
Martijn van Oosterhout <kleptog@svana.org> writes:
Seems to me that you could just do this by setting stdin to be
/dev/null?
No, because the simple_prompt code makes a point of reading from
/dev/tty.
regards, tom lane
On Fri, Dec 01, 2006 at 10:37:07AM -0500, Tom Lane wrote:
Martijn van Oosterhout <kleptog@svana.org> writes:
Seems to me that you could just do this by setting stdin to be
/dev/null?No, because the simple_prompt code makes a point of reading from
/dev/tty.
Sure, but that would fail for any process which has detached from the
terminal. The backup is stdin, which you can also setup.
Admittedly, the OP may not be in a position to setup the environment in
such a way as to make it work, which means that such an option may be
worthwhile...
If it's going to be an option, I'd suggest something like --daemon-mode
since it's entirely possible other issues tmay come up later that might
need this kind of attention.
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
From each according to his ability. To each according to his ability to litigate.
Martijn van Oosterhout wrote:
On Fri, Dec 01, 2006 at 10:37:07AM -0500, Tom Lane wrote:
Martijn van Oosterhout <kleptog@svana.org> writes:
Seems to me that you could just do this by setting stdin to be
/dev/null?No, because the simple_prompt code makes a point of reading from
/dev/tty.Sure, but that would fail for any process which has detached from the
terminal. The backup is stdin, which you can also setup.Admittedly, the OP may not be in a position to setup the environment in
such a way as to make it work, which means that such an option may be
worthwhile...If it's going to be an option, I'd suggest something like --daemon-mode
since it's entirely possible other issues tmay come up later that might
need this kind of attention.
So did we get anywhere with this? I'd propose something like
--non-interactive rather than --daemon-mode. Was there a patch
submitted?
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Alvaro Herrera wrote:
So did we get anywhere with this? I'd propose something like
--non-interactive rather than --daemon-mode. Was there a patch
submitted?
With the enhanced connection string management, wouldn't it suffice to
pass a (fake/empty) password to pg_dump on the command line?
--
Peter Eisentraut
http://developer.postgresql.org/~petere/