Re: ftell mismatch with expected position

From: Eelke Klein <eelke(at)bolt(dot)nl>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ftell mismatch with expected position
Date: 2015-11-06 09:27:58
Message-ID: CALEkvvwkGeD4SmxRjKLuU0_EXHRPVKeTKgVu5zSQjrYUjYoLHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2015-11-06 10:05:30 Re: pg_archivecleanup not deleting anything?
Previous Message John R Pierce 2015-11-06 08:44:05 Re: is there any difference DROP PRIMARY KEY in oracle and postgres?