From 08859bb5c2cebc132629ca838113d27bb31b990c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 23 Jun 2017 15:12:36 -0400 Subject: Fix replication with replica identity full The comparison with the target rows on the subscriber side was done with datumIsEqual(), which can have false negatives. For instance, it didn't work reliably for text columns. So use the equality operator provided by the type cache instead. Also add more user documentation about replica identity requirements. Reported-by: Tatsuo Ishii --- doc/src/sgml/logical-replication.sgml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index 92ec175af1..fa8ae536d9 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -110,11 +110,29 @@ Publications can choose to limit the changes they produce to any combination of INSERT, UPDATE, and DELETE, similar to how triggers are fired by - particular event types. If a table without a REPLICA - IDENTITY is added to a publication that - replicates UPDATE or DELETE - operations then subsequent UPDATE - or DELETE operations will fail on the publisher. + particular event types. By default, all operation types are replicated. + + + + A published table must have a replica identity configured in + order to be able to replicate UPDATE + and DELETE operations, so that appropriate rows to + update or delete can be identified on the subscriber side. By default, + this is the primary key, if there is one. Another unique index (with + certain additional requirements) can also be set to be the replica + identity. If the table does not have any suitable key, then it can be set + to replica identity full, which means the entire row becomes + the key. This, however, is very inefficient and should only be used as a + fallback if no other solution is possible. If a replica identity other + than full is set on the publisher side, a replica identity + comprising the same or fewer columns must also be set on the subscriber + side. See for details on + how to set the replica identity. If a table without a replica identity is + added to a publication that replicates UPDATE + or DELETE operations then + subsequent UPDATE or DELETE + operations will cause an error on the publisher. INSERT + operations can proceed regardless of any replica identity. -- cgit v1.2.3