• Tom Lane's avatar
    Remove manual tracking of file position in pg_dump/pg_backup_custom.c. · a8d0732a
    Tom Lane authored
    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
    a8d0732a
pg_backup_custom.c 22.3 KB