On Sun, Dec 2, 2012 at 4:37 AM, Alastair Turner <bell@ctrlf5.co.za> wrote:
> Patch for the changes discussed in
> http://archives.postgresql.org/pgsql-hackers/2010-10/msg00919.php
> attached (eventually ...)
>
> In summary: If the input file (-f) doesn't exist or the ouput or log
> files (-o and -l) can't be created psql exits before prompting for a
> password.
I assume you meant "-L" instead of "-l" here for specifying psql's log
file. I don't think that the inability to write to psql's log file
should be treated as a fatal error, especially since it is not treated
as such by the current code:
$ psql test -L /tmp/not_allowed psql: could not open log file "/tmp/not_allowed": Permission denied [... proceeds to
psqlprompt from here ...]
and the user (or script) may still usefully perform his work. Whereas
with your patch:
$ psql test -L /tmp/not_allowed psql: could not open log file "/tmp/not_allowed": Permission denied $
And IMO the same concern applies to the query results file, "-o".
Although +1 for the part about having psql exit early if the input
filename does not exist, since psql already bails out in this case,
and there is nothing else to be done in such case.
Josh