public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrus <[email protected]>
To: pgsql-general <[email protected]>
Subject: How to convert wal log to sql commands starting from specified time
Date: Tue, 18 Mar 2025 21:28:39 +0200
Message-ID: <[email protected]> (raw)

Hi!

Postgres 14 hot standby server server is running in Debian Linux under 
WSL. It saves wal log from master to pg_wal directory. wal_keep size is 
100GB.

Command

  pg_recvlogical -P pgoutput -o proto_version=1 -o 
publication_names=koiktabelid_pub --create-slot --start 
--slot=naitategevust --dbname=sba --file=tulem.log

writes modification commands to file

Command

pg_recvlogical --create-slot --start --slot=naitategevust --dbname=sba 
--file=-

show modification commands in screen.

How to specify start time and number of commands to decode as 
pg_recvlogical parameters?

Output is too verbose, contains data types.

How show next 100 sql commands starting from from some date, eq from 
March 18,2025 14:21:00 ?

If there is no ready solution, I can create ASP.NET MVC 9 controller for 
this. Controller should probably ask wal contents from server starting 
at this time using replication protocol or directly read wal files from 
pg_wal directory and decode them.

Replication sample in https://www.npgsql.org/doc/replication.html
shows how to decode realtime replication messages for single table.

How to specify start time from which replication commands are retured? 
Or is there some exisising wal decoder in C# or as command-line utility?

Posted also in

https://stackoverflow.com/questions/79518438/how-to-convert-wal-log-to-sql-commands-from-given-time

Andrus


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: How to convert wal log to sql commands starting from specified time
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox