A function for extracting the components of a WAL file name
This entry relates to a PostgreSQL feature which is part of PostgreSQL 16, due to be released in late 2023.

pg_split_walfile_name() is a system function for extracting the file sequence number and timeline ID from a WAL file name.

pg_split_walfile_name() was added in PostgreSQL 16.


pg_split_walfile_name ( file_name text ) → 
        record ( segment_number numeric, timeline_id bigint )

Change history


Basic usage example for pg_split_walfile_name():

postgres=# SELECT * FROM pg_split_walfile_name('000000010000001000000012');
 segment_number | timeline_id 
           4114 |           1
(1 row)


System function, WAL

See also

pg_walfile_name(), pg_walfile_name_offset(), pg_ls_waldir()