The following bug has been logged online:
Bug reference: 3462
Logged by: Eugene Gershnik
Email address: gershnik@hotmail.com
PostgreSQL version: 8.2.4
Operating system: Windows
Description: pg_ctl error output cannot be redirected
Details:
On Windows an attempt to do
pg_ctl ... > file.txt 2>&1
where ... stands for any parameters that make pg_ctl fail sends stderr
output to event log rather than file.txt.
This is caused by the following incorrect test in pg_ctl.c in function
write_stderr(const char *fmt,...)
if (!isatty(fileno(stderr)))
...
This test will succeed for anything other than console being stderr. It is
obviously incorrect since when the output is redirected to a file or pipe
you also want to print it rather than to send it to event log. What you need
to test is whether GetStdHandle returns an invalid handle.