Closed zhanghaiyang9999 closed 1 year ago
Could you try setting ALTER TABLE mytable REPLICA IDENTITY FULL;
? You should understand the impact before doing that in prod though.
@JordanP Thanks, if I executed the sql "ALTER TABLE mytable REPLICA IDENTITY FULL", the OldTuple is not nil, But my test table has primary key, I think the identify FULL just for the table that has not the primary key case.
@zhanghaiyang9999 not exactly. This page says
In the case of DEFAULT, old tuple data is only identified with the primary key of the table. This data is written into WAL only when at least one column of the primary key is updated. Columns that are not part of the primary key do not have their old value written.
Whereas with FULL
:
In the case of FULL, all the column values are written to WAL all the time. This is the most verbose, and as well the most resource-consuming mode. Be careful here particularly for heavily-updated tables.
Thanks @JordanP for the detail. I have another issue, the pglogrepl can't capture one of my test tables changes such as insert, update and delete. but all the other test tables worked well, except this one table. I can't confirm this is the pglogrepl issue or the postgresql issue.
I used the example code to test the logic replication, Insert and Delete operations are good, but the Update operation is incorrect, the OldTuple is nil for the Update event. @jackc BTW: the test table has primary key.