pg_split_walfile_name

From: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: pg_split_walfile_name
Date: 2025-07-31 08:08:25
Message-ID: CAA5-nLCE4PyT7Dh5ogNwBc=dwdA2T58Kc7uWHN4fW1GmKPAG4w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

In the documentation, PostgreSQL: Documentation: 17: 9.28. System
Administration Functions
<https://www.postgresql.org/docs/current/functions-admin.html>, I do not
understand the position 100C in the wal filename and how the result could
be C001?

Any idea?

Regards,

Fabrice

pg_split_walfile_name is useful to compute a LSN from a file offset and WAL
file name, for example:

postgres=# \set file_name '000000010000000100C000AB'
postgres=# \set offset 256
postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int
+ :offset AS lsn
FROM pg_split_walfile_name(:'file_name') pd,
pg_show_all_settings() ps
WHERE ps.name = 'wal_segment_size';
lsn
---------------
C001/AB000100
(1 row)

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Raj 2025-07-31 10:18:21 Post Oracle to Postgres migartion
Previous Message Sam Stearns 2025-07-29 15:00:47 Re: Linux VM Sizing