[Techtalk] Using > to redirect standard error?

Rachel McConnell rachel at xtreme.com
Tue Jan 13 20:01:47 EST 2004


Hallo Experts,

I am attempting to move a lot of data from MySQL to PostgreSQL, having
dumped the MySQL data into a text file.  As you can imagine, the SQL is
somewhat different, and I'm having Lots Of Errors, as well as more
normal log output.  They scroll off the screen almost instantly, too
fast to see what any but the very last errors are.  I'd like to save the
errors so I can use them to correct the next versions of the dump
script.  I've tried this:

$ psql [options omitted] > errorLog.txt

As I understand it, the > should redirect the output of the psql program
into the file errorLog.txt.  What is actually happening is that SOME of
the output goes into the file, and some stays on the screen.  The
messages that stay onscreen are of course the error messages...

So I've come up with the theory that there are two outputs which both
normally print to console, call them stdout and stderr.  > appears to
redirect stdout, but not stderr.

Is this theory correct, or even close?
Is there a way to save the stderr output?

I'm using cygwin on a win2k box.  I don't have a linux box available to
me that has access to the PostgreSQL psql client, if that would even be
any different.

Any help appreciated!

Rachel



More information about the Techtalk mailing list