Re: BUG #11477: psql -L no stderr

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11477: psql -L no stderr
Date: 2014-10-02 22:56:52
Message-ID: 1412290612581-5821492.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-bugs by date

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