Re: BUG #11477: psql -L no stderr - Mailing list pgsql-bugs

From David G Johnston
Subject Re: BUG #11477: psql -L no stderr
Date
Msg-id 1412290612581-5821492.post@n5.nabble.com
Whole thread Raw
In response to Re: BUG #11477: psql -L no stderr  (Bruce Momjian <bruce@momjian.us>)
List pgsql-bugs
Bruce Momjian wrote
>> I am sorry, but log without errors logging is NOT a log file. I consider
>> not
>> logging stderr to logfile when -L is specified as a bug.
>>
>> Please add coppying also stderr to logfile when -L.
>
> The documentation says:
>
>        -L filename
>        --log-file=filename
>            Write all query output into file filename, in addition to the
> normal output destination.
>
> There is no mention of errors being logged here.  Logging is more than
> logging of errors.

For further emphasis:

Under \o

"Query results" includes all tables, command responses, and notices obtained
from the database server, as well as output of various backslash commands
that query the database (such as \d), but not error messages.


Though playing with it a bit I'll agree that the functionality seems
artificially constrained.  Unfortunately, simply changing the behavior
doesn't seem like it is something that would obtain sufficient support for
the backward compatibility break.

Would something like the below work?

psql -L filename.txt -L -c "SELECT 1 = 'txt'";

The idea being you can specify a plain "-L" flag a second time and it will
redirect stderr to the same location specified in the first flag.

Being able to supervise a script but have it completely captured in the
activity log makes sense.  I guess setting ECHO to 'queries' and simply
redirecting all output to a file would be the current imposed solution but
the -L option has the nice property of cleanly setting off the "input" query
from that query's output.

I don't get why notices and warnings would be considered "query output"
while the error message resulting from a failed query would not.  I need
more than "its documented" to really convince me that this isn't an
incomplete feature - which while not a technical bug is arguably a usage
one.

I haven't thought through all possible use-cases/combination for/of terminal
& file output but taken in isolation the goal stated here makes sense and is
not currently possible - at best you get your complete file but lose the
ability to view the errors on the terminal.  Am I missing something?

David J.



--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-11477-psql-L-no-stderr-tp5820153p5821492.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

pgsql-bugs by date:

Previous
From: John R Pierce
Date:
Subject: Re: BUG #11553: Sum function does not exist in Create View
Next
From: Tom Lane
Date:
Subject: Re: BUG #11554: Enforce that number and type of both columns involved in fkey are same type