]> granicus.if.org Git - postgresql/commit
Fix logical replication between different encodings
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 5 Apr 2017 14:44:23 +0000 (10:44 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Thu, 6 Apr 2017 18:41:09 +0000 (14:41 -0400)
commit6f1b9aaae35bfabe2654a8e44ce226c91e7d8bd9
tree89c253c4c192e2177bcb602da258d3831490e0d4
parent5f21f5292c0856536ac0724974a8bc6b296b9ef6
Fix logical replication between different encodings

When sending a tuple attribute, the previous coding erroneously sent the
length byte before encoding conversion, which would lead to protocol
failures on the receiving side if the length did not match the following
string.

To fix that, use pq_sendcountedtext() for sending tuple attributes,
which takes care of all of that internally.  To match the API of
pq_sendcountedtext(), send even text values without a trailing zero byte
and have the receiving end put it in place instead.  This matches how
the standard FE/BE protocol behaves.

Reported-by: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
doc/src/sgml/protocol.sgml
src/backend/replication/logical/proto.c
src/test/subscription/t/005_encoding.pl [new file with mode: 0644]