Thread

  1. Re: Tighten up range checks for pg_resetwal arguments

    Andrey Borodin <x4mmm@yandex-team.ru> — 2025-12-05T18:49:30Z

    
    > On 4 Dec 2025, at 00:07, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
    > 
    > I got a little annoyed by how lax pg_resetwal is about out-of-range values.
    
    A little bit offtopic, but anyway.
    
    It's kind of common practice for many tools.
    We actually had a corruption after pg_upgrade inflicted by the bug in upgrade script.
    Here's the bugfix:
            exe(
                '/usr/bin/timeout 300 '
    -            'sudo -u postgres /usr/lib/postgresql/{version_to}/bin/vacuumdb  --port {port}'
    +            'sudo -u postgres /usr/lib/postgresql/{version_to}/bin/vacuumdb  --port {port} '
                '--analyze-in-stages --all -j 8',
                context={'port': 7432},
                allow_fail=True,
            )
    
    Absence of space was ignored by vacuumdb. Executed command:
    
      vacuumdb --port 7432--analyze-in-stages
    
    was expected to analyze only, but made a vacuum. That was not rsynced later.
    
    So +1 from me on the strict parsing of arguments by sharp tools like pg_resetwal.
    
    
    Best regards, Andrey Borodin.