Обсуждение: Diffs in PG output vs WAL

Поиск
Список
Период
Сортировка

Diffs in PG output vs WAL

От
V
Дата:
I am playing with pgoutput and logical replication. With wal2json, I could capture the old values before the row was updated. I am unable to figure out how to do that with pgoutput. Does pgoutput even support this?

Relevant info from wal2json:

> Also, UPDATE/DELETE old row versions can be accessed depending on the configured replica identity
> All of the new/old tuples are available in the JSON object.

https://github.com/eulerto/wal2json

I want new/old tuples with pgoutput. how?

--
Avinash

Re: Diffs in PG output vs WAL

От
Christophe Pettus
Дата:

> On Sep 1, 2022, at 10:14, V <avinash@verloop.io> wrote:
> I want new/old tuples with pgoutput. how?

I assume here you are reading the pgoutput protocol directly.

Logical decoding sends out two tuple structures:

1. The replica identity of the row (in the case of update and delete).
2. The new row data (in the case of update and insert).

If you want to get the entire content of the old row, you'll need to set the table as REPLICA IDENTITY FULL.  This is
somethingof a hack, and *greatly* increases the data volume, so you may want to use the subscribing side for the old
tuple(perhaps captured with a trigger).