Re: ftell mismatch with expected position - Mailing list pgsql-general

From Eelke Klein
Subject Re: ftell mismatch with expected position
Date
Msg-id CALEkvvwkGeD4SmxRjKLuU0_EXHRPVKeTKgVu5zSQjrYUjYoLHQ@mail.gmail.com
Whole thread Raw
In response to Re: ftell mismatch with expected position  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Presumably it doesn't happen without the use of the pipe notation.

Indeed, it only happens when a pipe is involved.
 

I suspect that what's happening is that stdout isn't getting put into
binary mode, so that Microsoft's CR/NL translation corrupts the data.
If that's true, though, the resulting backup file should be corrupt;
is it valid according to "pg_restore backupfile"?

Yes pg_restore restores it without problems. However I did notice that it is larger then normal. 

I have also tested what happens on freebsd when using a pipe and there are no warnings and backup is expected size.

I dug into the source code of pg_dump and found that the warning is given by _getFilePos(ArchiveHandle *AH, lclContext *ctx) in pg_backup_custom.c but it won't  if ctx->hasSeek is set to false. Which is initialized by a call to checkSeek in pg_backup_archiver.c. Unfortunatly I'm not yet able to build and debug ton windows to verify if a correction to this function would help.

regards, Eelke


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: is there any difference DROP PRIMARY KEY in oracle and postgres?
Next
From: Albe Laurenz
Date:
Subject: Re: pg_archivecleanup not deleting anything?