Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jWK7o-0007dI-6W for pgsql-general@arkaria.postgresql.org; Wed, 06 May 2020 13:30:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jWK7n-00041U-3Y for pgsql-general@arkaria.postgresql.org; Wed, 06 May 2020 13:30:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jWK7m-00041M-SO for pgsql-general@lists.postgresql.org; Wed, 06 May 2020 13:30:10 +0000 Received: from [87.230.15.127] (helo=lvps87-230-15-127.dedicated.hosteurope.de) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jWK7k-0004Ut-7k for pgsql-general@lists.postgresql.org; Wed, 06 May 2020 13:30:10 +0000 Received: from snob.fritz.box (174.54.150.83.ftth.ewwwb.as8758.net [83.150.54.174]) by lvps87-230-15-127.dedicated.hosteurope.de (Postfix) with ESMTPSA id 9F63A1D6A43; Wed, 6 May 2020 15:29:36 +0200 (CEST) Subject: Re: Encoding conversion: Use replacement character instead of failing query with "ERROR: character with byte sequence 0xd0 0xad in encoding "UTF8" has no equivalent in encoding LATIN1" ? To: Tom Lane Cc: "pgsql-general@lists.postgresql.org" References: <3c30a47a-09c8-8b36-3ebb-6336c0f089d6@networkz.ch> <1791.1588723247@sss.pgh.pa.us> From: Christian Ramseyer Message-ID: <28813188-e0fb-08b6-9eb5-cb6096231062@networkz.ch> Date: Wed, 6 May 2020 15:29:36 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <1791.1588723247@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 87.230.15.127 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 06.05.20 02:00, Tom Lane wrote: > Christian Ramseyer writes: >> Can I somehow influence the client:UTF8->server:LATIN1 character set >> conversion so that instead of failing, it inserts an invalid codepoint >> character, the utf8 hex bytes as string, drops the character or >> something like that? > > There's nothing built-in for that, but it seems like it wouldn't be > hard to modify the code if you wanted a quick hack to do this. > > In general, the system nominally supports multiple conversion functions > per encoding pair, so you could imagine having an alternate conversion > that doesn't throw errors. Problem is that it's quite difficult to get > the system to actually *use* a non-default conversion for anything really > significant, like say client I/O. I don't know that anyone's thought > hard about how to improve that. > Thanks Tom, that's basically like I suspected how it was, but I wanted to make sure I'm not overlooking an easy workaround with a simple "create conversion" or similar. I really appreciate the quick answers from highly qualified people I'm getting on here, without exceptions. If only "enterprise" product support worked like that :) Cheers Christian -- Christian Ramseyer, netnea ag Network Management. Security. OpenSource. https://www.netnea.com