1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-20 15:22:23 +03:00

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>
This commit is contained in:
Peter Eisentraut
2017-06-23 15:12:36 -04:00
parent 0b13b2a771
commit 08859bb5c2
3 changed files with 59 additions and 11 deletions

View File

@ -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>