How to read PostgreSQL wal file data? Is there is any command to convert PostgreSQL binary to readable text format?
Asked Answered
B

2

8

I am trying to read PostgreSQL wal file. Its a binary file and I am not able to read wal file data in text format. Can anyone help me for this. Is there any command or something to read the wal file data?

Buhr answered 24/4, 2019 at 10:50 Comment(1)
Unrelated, but: are you really still using Postgres 9.2? That version is no longer supported you should plan your upgrade to a supported version now.Jointworm
R
7

Generally, there are two options in Postgres for presenting WALs in some human-readable format:

  1. pg_waldump utility, but it is available only in 9.3+. You can try using pg_waldump from 9.3 with 9.2 WALs, but I am not sure in success. It may work, since there should not be any new WAL record types in 9.2, which do not exist in 9.3. Note: pg_waldump was called pg_xlogdump until Postgres 10.0
  2. Also it is possible to utilize logical decoding, but it is available since 9.4. Anyway, with logical decoding one can use various plugins like wal2json to export records in the human-readable format. Note: logical decoding may do not decode every WAL record, it is mostly about DML (insert/update/delete)

Thus, I would strongly recommend to upgrade your cluster to Postgres 9.4 at least.

Riojas answered 24/4, 2019 at 11:27 Comment(0)
I
0

You should use wal2json, but it only work for pg9.4+

https://github.com/eulerto/wal2json

Isotherm answered 24/4, 2019 at 10:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.