1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Don't reset additional columns on subscriber to NULL on UPDATE

When a publisher table has fewer columns than a subscriber, the update
of a row on the publisher should result in updating of only the columns
in common.  The previous coding mistakenly reset the values of
additional columns on the subscriber to NULL because it failed to skip
updates of columns not found in the attribute map.

Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
This commit is contained in:
Peter Eisentraut
2017-11-03 11:59:20 -04:00
parent ec42a1dcb3
commit a9fce66729
2 changed files with 85 additions and 2 deletions

View File

@ -391,10 +391,13 @@ slot_modify_cstrings(TupleTableSlot *slot, LogicalRepRelMapEntry *rel,
Form_pg_attribute att = TupleDescAttr(slot->tts_tupleDescriptor, i);
int remoteattnum = rel->attrmap[i];
if (remoteattnum >= 0 && !replaces[remoteattnum])
if (remoteattnum < 0)
continue;
if (remoteattnum >= 0 && values[remoteattnum] != NULL)
if (!replaces[remoteattnum])
continue;
if (values[remoteattnum] != NULL)
{
Oid typinput;
Oid typioparam;