pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix logical replication between different encodings
Date: Thu, 06 Apr 2017 18:43:16 +0000
Message-ID: <E1cwCNI-0007QS-3r@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

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>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6f1b9aaae35bfabe2654a8e44ce226c91e7d8bd9

Modified Files
--------------
doc/src/sgml/protocol.sgml              |  7 +++--
src/backend/replication/logical/proto.c | 10 +++----
src/test/subscription/t/005_encoding.pl | 46 +++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 8 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1cwCNI-0007QS-3r@gemulon.postgresql.org>
Permalink:  ../E1cwCNI-0007QS-3r@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1cwCNI-0007QS-3r@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter_e@gmx.net
  Subject: Re: pgsql: Fix logical replication between different encodings
  In-Reply-To: <E1cwCNI-0007QS-3r@gemulon.postgresql.org>
  References: <E1cwCNI-0007QS-3r@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox