logical decoding: old/newtuple in spooled UPDATE changes was switched around.
authorAndres Freund
Sun, 6 Mar 2016 02:02:20 +0000 (18:02 -0800)
committerAndres Freund
Sun, 6 Mar 2016 02:02:20 +0000 (18:02 -0800)
commite76e365be9e7fc30f19d21962461a0046d15ea5d
tree69a5a02e3f480dc9883196b346fc516082b1594c
parent6e759cefe809cb7852cdf6ea3088d8604a817185
logical decoding: old/newtuple in spooled UPDATE changes was switched around.

Somehow I managed to flip the order of restoring old & new tuples when
de-spooling a change in a large transaction from disk. This happens to
only take effect when a change is spooled to disk which has old/new
versions of the tuple. That only is the case for UPDATEs where he
primary key changed or where replica identity is changed to FULL.

The tests didn't catch this because either spooled updates, or updates
that changed primary keys, were tested; not both at the same time.

Found while adding tests for the following commit.

Backpatch: 9.4, where logical decoding was added
contrib/test_decoding/expected/ddl.out
contrib/test_decoding/sql/ddl.sql
src/backend/replication/logical/reorderbuffer.c