Re: User control over psql error stream

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: User control over psql error stream
Date: 2012-11-22 05:33:18
Message-ID: 1353562398.10996.2@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/21/2012 01:41:56 PM, Peter Eisentraut wrote:
> On 11/15/12 3:53 PM, Karl O. Pinc wrote:
> > This patch gives the end user control over psql's
> > error stream. This allows a single psql session
> > to use \o to send both errors and table output
> > to multiple files. Useful when capturing test output, etc.
>
> What does this do that cannot in practice be achieved using shell
> redirection operators?

To look at it from another angle, you need it for the
same reason you need \o -- to redirect output
to multiple places from within a single psql process.
\o redirects stdout, but I'm interested in
redirecting stderr.

Which makes me think that instead of a \pset
option a, say, \e, command is called for.
This would do the same thing \o does only
for stderr instead of stdout.

The problem comes
when you want \e to send to the same place \o
sends to, or vice versa. You can't just compare textual paths
because there's more than one way to write
a path to an object in the filesystem.
You need either a "special" argument
to \e and \o -- very ungood as it breaks
backwards compatibility with \o --
or you need, perhaps, yet another \
command to send stderr to where \o
is going or, conversely, send \o
to where stderr is going. Perhaps\oe
could send \o output to where stderr
is going at the moment and \eo could
send stderr output to where \o output
is going at the moment?

Sorry to ramble on. I'm tired.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranjeet Dhumal 2012-11-22 05:38:53 Re: ERROR: volatile EquivalenceClass has no sortref
Previous Message Andrew Dunstan 2012-11-22 04:24:03 Re: WIP json generation enhancements