postgresql/src/include/replication
Andres Freund 1b86c81d2d Fix decoding of MULTI_INSERTs when rows other than the last are toasted.
When decoding the results of a HEAP2_MULTI_INSERT (currently only
generated by COPY FROM) toast columns for all but the last tuple
weren't replaced by their actual contents before being handed to the
output plugin. The reassembled toast datums where disregarded after
every REORDER_BUFFER_CHANGE_(INSERT|UPDATE|DELETE) which is correct
for plain inserts, updates, deletes, but not multi inserts - there we
generate several REORDER_BUFFER_CHANGE_INSERTs for a single
xl_heap_multi_insert record.

To solve the problem add a clear_toast_afterwards boolean to
ReorderBufferChange's union member that's used by modifications. All
row changes but multi_inserts always set that to true, but
multi_insert sets it only for the last change generated.

Add a regression test covering decoding of multi_inserts - there was
none at all before.

Backpatch to 9.4 where logical decoding was introduced.

Bug found by Petr Jelinek.
2014-07-06 15:58:01 +02:00
..
basebackup.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
decode.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
logical.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
logicalfuncs.h Introduce logical decoding. 2014-03-03 16:32:18 -05:00
output_plugin.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
reorderbuffer.h Fix decoding of MULTI_INSERTs when rows other than the last are toasted. 2014-07-06 15:58:01 +02:00
slot.h Consistency improvements for slot and decoding code. 2014-06-12 13:33:27 +02:00
snapbuild.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
syncrep.h Update copyright for 2014 2014-01-07 16:05:30 -05:00
walreceiver.h pgindent run for 9.4 2014-05-06 12:12:18 -04:00
walsender.h Allow logical decoding via the walsender interface. 2014-03-10 13:50:28 -04:00
walsender_private.h Update copyright for 2014 2014-01-07 16:05:30 -05:00