Re: Logical Replication and Character encoding

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: craig(at)2ndquadrant(dot)com, noriyoshi(dot)shinoda(at)hpe(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Logical Replication and Character encoding
Date: 2017-02-15 22:55:06
Message-ID: 96bbdd81-a228-8cf2-2161-02eb2361f6a1@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14/02/17 03:23, Kyotaro HORIGUCHI wrote:
> At Sat, 4 Feb 2017 21:27:32 +0100, Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com> wrote in <bcc7f7e9-f558-b19e-b544-000ba7cf286c(at)2ndquadrant(dot)com>
>> Hmm I wonder if we should just make the subscriber send the
>> client_encoding always (based on server encoding of the subscriber).
>> That should solve the issue in combination with your patch no?
>
> Yeah, right. I considered that a subscriber might want to set its
> own value for that but that is useless.
>
> The attached patch does the following things to just prevent
> making a logical replication connection between databases with
> inconsistent encodings.
>
> - added client_encoding with subscriber(or standby)'s encoding at
> the last of options in libpqrcv_connect.
>
> - CheckLogicalDecodingRequirements refuses connection for a
> request with inconsistent encodings.
>
>> ERROR: logical replication requires consistent encodings on both side (publisher = UTF8, subscriber = EUC_JP)
>

I am not quite convinced that this should be handled by logical decoding
itself. It's quite possible to have output plugins that will handle this
correctly for their use-cases (by doing similar conversion you did in
the original patch) so they should not be prevented doing so.
So it's probably better to check this in the plugin.

I do like the idea of just using client_encoding in libpqrcv_connect though.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-02-15 23:04:31 Re: bytea_output vs make installcheck
Previous Message Petr Jelinek 2017-02-15 22:52:45 Re: DROP SUBSCRIPTION and ROLLBACK