Remove manual tracking of file position in pg_dump/pg_backup_custom.c.
authorTom Lane
Fri, 17 Jul 2020 16:14:28 +0000 (12:14 -0400)
committerTom Lane
Fri, 17 Jul 2020 17:04:06 +0000 (13:04 -0400)
commit447cf2f8e9dcf9fd89c935f2daee13326a91630a
tree21b9a157fb03264dda23689a55e4763c29f4f000
parent49eb96852b02069600a4f6997dfb388fc37a2778
Remove manual tracking of file position in pg_dump/pg_backup_custom.c.

We do not really need to track the file position by hand.  We were
already relying on ftello() whenever the archive file is seekable,
while if it's not seekable we don't need the file position info
anyway because we're not going to be able to re-write the TOC.

Moreover, that tracking was buggy since it failed to account for
the effects of fseeko().  Somewhat remarkably, that seems not to
have made for any live bugs up to now.  We could fix the oversights,
but it seems better to just get rid of the whole error-prone mess.

In itself this is merely code cleanup.  However, it's necessary
infrastructure for an upcoming bug-fix patch (because that code
*does* need valid file position after fseeko).  The bug fix
needs to go back as far as v12; hence, back-patch that far.

Discussion: https://postgr.es/m/CALBH9DDuJ+scZc4MEvw5uO-=vRyR2=QF9+Yh=3hPEnKHWfS81A@mail.gmail.com
src/bin/pg_dump/pg_backup_custom.c