summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorPeter Eisentraut2017-06-23 19:12:36 +0000
committerPeter Eisentraut2017-06-23 19:40:17 +0000
commit08859bb5c2cebc132629ca838113d27bb31b990c (patch)
tree8dcb2d337a50b81c70c9769306c66e9f6b107a7f /doc/src
parent0b13b2a7712b6f91590b7589a314240a14520c2f (diff)
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 <ishii@sraoss.co.jp>
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/logical-replication.sgml28
1 files changed, 23 insertions, 5 deletions
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 <command>INSERT</command>, <command>UPDATE</command>, and
<command>DELETE</command>, similar to how triggers are fired by
- particular event types. If a table without a <literal>REPLICA
- IDENTITY</literal> is added to a publication that
- replicates <command>UPDATE</command> or <command>DELETE</command>
- operations then subsequent <command>UPDATE</command>
- or <command>DELETE</command> operations will fail on the publisher.
+ particular event types. By default, all operation types are replicated.
+ </para>
+
+ <para>
+ A published table must have a <quote>replica identity</quote> configured in
+ order to be able to replicate <command>UPDATE</command>
+ and <command>DELETE</command> 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 <quote>full</quote>, 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 <quote>full</quote> is set on the publisher side, a replica identity
+ comprising the same or fewer columns must also be set on the subscriber
+ side. See <xref linkend="SQL-CREATETABLE-REPLICA-IDENTITY"> for details on
+ how to set the replica identity. If a table without a replica identity is
+ added to a publication that replicates <command>UPDATE</command>
+ or <command>DELETE</command> operations then
+ subsequent <command>UPDATE</command> or <command>DELETE</command>
+ operations will cause an error on the publisher. <command>INSERT</command>
+ operations can proceed regardless of any replica identity.
</para>
<para>