Thread

  1. Is there any reason why pg_walfile_name() doesn't take timeline change into consideration?

    hubert depesz lubaczewski <depesz@depesz.com> — 2026-05-18T12:27:08Z

    Hi,
    I tried on a server that is on timeline 7 now, with .history being:
    
    1       A9/5E0000A0     no recovery target specified
    2       127/EB0000A0    no recovery target specified
    3       127/F40000A0    no recovery target specified
    4       128/170000A0    no recovery target specified
    5       188/C70000A0    no recovery target specified
    6       7B8/90000A0     no recovery target specified
    
    
    When I wal file that is "current", i get sensible filename:
    
    =# select pg_walfile_name('800/123');
         pg_walfile_name
    ══════════════════════════
     000000070000080000000000
    (1 row)
    
    But when I try to find walfile for old lsn, from older timeline, I'm getting bad results:
    
    =# select pg_walfile_name('125/123');
         pg_walfile_name
    ══════════════════════════
     000000070000012500000000
    (1 row)
    
    Timeline 7 was was "there" when wal lsn was 125/…. Is it just missing
    functionality, or am I missing something more complicated?
    
    Best regards,
    
    depesz