1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

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>
This commit is contained in:
Peter Eisentraut
2017-04-05 10:44:23 -04:00
parent 5f21f5292c
commit 6f1b9aaae3
3 changed files with 55 additions and 8 deletions

View File

@ -6107,11 +6107,14 @@ TupleData
</varlistentry>
<varlistentry>
<term>
String
Byte<replaceable>n</replaceable>
</term>
<listitem>
<para>
The text value.
The value of the column, in text format. (A future release
might support additional formats.)
<replaceable>n</replaceable> is the above length.
</para>
</listitem>
</varlistentry>