Opening stdin/stdout in binary mode on Windows

Tom Lane <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
I wrote:
>> pg_restore: [archiver] unsupported version (1.13) in file header

> Come to think of it, I'll bet that you cannot use "> DBFile" on Windows
> because it ends up opening the archive file in text instead of binary
> mode.  SetOutput() in pg_backup_archiver.c tries to work around this by
> doing

> 	fn = fileno(stdout);
> 	AH->OF = fdopen(dup(fn), PG_BINARY_W);

> but it wouldn't surprise me in the least to learn that that doesn't work
> on Windows.

We now have confirmation that indeed this is the source of the pg_dump
misbehavior.  Can anyone suggest a way that does work to do binary I/O
on stdout?  What about reading from stdin?

If we can't fix this it will require some serious uglification of the
pg_dump/pg_restore docs for Windows ...

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.