Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8Zus-0005nd-5W for pgsql-general@arkaria.postgresql.org; Tue, 26 Mar 2019 00:26:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h8Zuq-0007BR-F9 for pgsql-general@arkaria.postgresql.org; Tue, 26 Mar 2019 00:26:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8Zuq-0007BK-6c for pgsql-general@lists.postgresql.org; Tue, 26 Mar 2019 00:26:08 +0000 Received: from sonic312-22.consmr.mail.bf2.yahoo.com ([74.6.128.84]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8Zul-0006Iy-Pv for pgsql-general@lists.postgresql.org; Tue, 26 Mar 2019 00:26:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1553559961; bh=uLvd8xgaVfTyJZmO+lriKPlx0DdgbmuUb14vP26LTT0=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=YyLYSLkOxQhKvogGPCRfhaZJwJDR5SZiT5nvWyiCbzq74IY6Eipth+ZS7iUakalHeoxZi5gmPnNP46+d1OoCBEfF0055xxPkFUHgRAs8gj765pSPuJ93TGWq4DhMG9lX0PL71r9SehhQ6T/3t83KlYt7YhuWRKyzm4uqtarX3mf9Hc+Y7nsyg9P2AJ7BP+SpIVl1WawoZb7CGbXDfqvCyu7AqQI0egCbudwSTPoItmMnXp2kdPKz7Z5AkOydMJsOiz9v4STAiRYwOvNQycYZfC4qLZOgVddSE7TvrlbP8P4DspZq89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rtXXiYjBcabf0BsBb_wrcIXgFS4ya4ztbb IVcY6qRF9ggz6u2mA4FCZZQWzQrRVruX5ytRoo7FkhCz_Vjpu3nNiTdx3GDfquVlEpkpTDGQsZ9m YDWGdK5bJcTyRrZT6_TFp_B_FxFElbVTJ3SUBHA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.bf2.yahoo.com with HTTP; Tue, 26 Mar 2019 00:26:01 +0000 Date: Tue, 26 Mar 2019 00:25:49 +0000 (UTC) From: Thomas Tignor To: Vijaykumar Jain , Brad Nicholson Cc: "pgsql-general@lists.postgresql.org" Message-ID: <458346306.10942574.1553559949857@mail.yahoo.com> In-Reply-To: References: <1080815989.10741938.1553539577631.ref@mail.yahoo.com> <1080815989.10741938.1553539577631@mail.yahoo.com> Subject: Re: [External] postgres 9.5 DB corruption: invalid byte sequence for encoding "UTF8" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10942573_586540001.1553559949855" X-Mailer: WebService/1.1.13212 YMailNorrin Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36 Content-Length: 5719 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_10942573_586540001.1553559949855 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Brad,Thanks for writing. As I mentioned to Vijay, the "source" is a JVM = using the postgres v42.0.0 JDBC driver. I do not believe we have any explic= it encoding set, and so I expect the client encoding is SQL_ASCII. The DB i= s most definitely UTF8. Our log shows no issue with the input data we've di= scovered (at the time that it's logged.) If the data is somehow corrupted b= efore inserting, won't the server encoding kick in and generate an error? W= e can certainly test that. Tom =C2=A0 =C2=A0:-)=20 On Monday, March 25, 2019, 3:56:04 PM EDT, Brad Nicholson wrote: =20 =20 =20 Vijaykumar Jain wrote on 03/25/2019 03:07:19 PM: > but why do you think this as db corruption and not just a bad input? > INVALID URI REMOVED > u=3Dhttps-3A__github.com_postgres_postgres_blob_master_src_pl_plperl_expe= cted_plperl-5Flc-5F1.out&d=3DDwIFaQ&c=3Djf_iaSHvJObTbx- > siA1ZOg&r=3DBX8eA7xgfVJIpaY_30xSZQ&m=3D7u71qfQylE2M0dQlbUBn399O53IK1HQHm- > Unxl9LUzw&s=3DK6nXHvrx3aX4riGMLnucLoRa76QNC0_TOS5R4AziTVM&e=3D This looked interesting to me in the settings below: > =C2=A0 client_encoding =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0| SQL_ASCII =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| client Unless you have set this explicitly, it will use the default encoding for t= he database. =C2=A0If it hasn't been explicitly set, then the source databa= se (assuming that that output was from the source) is SQL_ASCII. Double check the database encoding for the source database and target datab= ase. =C2=A0I'm wondering if you have SQL_ASCII for the source, and UTF8 for= the target. =C2=A0If that is the case, you can take invalid UTF8 character= s into the source, and they will fail to replicate to the target. =C2=A0Tha= t's not a Postgres problem, but an encoding mismatch Brad =20 ------=_Part_10942573_586540001.1553559949855 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Brad,
Thanks for writing. As I mentioned to Vijay= , the "source" is a JVM using the postgres v42.0.0 JDBC driver. I do not be= lieve we have any explicit encoding set, and so I expect the client encodin= g is SQL_ASCII. The DB is most definitely UTF8. Our log shows no issue with= the input data we've discovered (at the time that it's logged.) If the dat= a is somehow corrupted before inserting, won't the server encoding kick in = and generate an error? We can certainly test that.

Tom    :-)


=20
=20
On Monday, March 25, 2019, 3:56:04 PM EDT, Brad Nichols= on <bradn@ca.ibm.com> wrote:


Vijaykumar Jain <vjain@opentable.com> wrote on 03/25/2019= 03:07:19 PM:


> = but why do you think this as db corruption and not just a bad input?
> INVALID URI REMOVED
> u=3Dhttps-3A__github.com_postgres_postgres_blob_master_src_pl_plperl= _expected_plperl-5Flc-5F1.out&d=3DDwIFaQ&c=3Djf_iaSHvJObTbx-
> siA1ZOg&r=3DBX8eA7xgfVJIpaY_30xSZQ&m=3D7u71qfQylE2= M0dQlbUBn399O53IK1HQHm-
> Unxl9LUzw&s=3DK6nXHvrx3a= X4riGMLnucLoRa76QNC0_TOS5R4AziTVM&e=3D


This looked interesting to me in the settings below:



&g= t;   client_encoding               =  | SQL_ASCII          | client


Unless you have set this explicitly, it will use the default encodin= g for the database.  If it hasn't been explicitly set, then the source= database (assuming that that output was from the source) is SQL_ASCII.

Double c= heck the database encoding for the source database and target database. &nb= sp;I'm wondering if you have SQL_ASCII for the source, and UTF8 for the tar= get.  If that is the case, you can take invalid UTF8 characters into t= he source, and they will fail to replicate to the target.  That's not = a Postgres problem, but an encoding mismatch
=

= Brad

------=_Part_10942573_586540001.1553559949855--