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 1lb14a-0002Jw-Tq for pgsql-general@arkaria.postgresql.org; Mon, 26 Apr 2021 13:14:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lb14Y-0002Ap-P6 for pgsql-general@arkaria.postgresql.org; Mon, 26 Apr 2021 13:14:46 +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 1lb14Y-0002Ah-Hb for pgsql-general@lists.postgresql.org; Mon, 26 Apr 2021 13:14:46 +0000 Received: from ms-10.1blu.de ([178.254.4.101]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lb14W-00062e-2W for pgsql-general@lists.postgresql.org; Mon, 26 Apr 2021 13:14:46 +0000 Received: from [188.174.57.250] (helo=c720-r368166.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lb14U-00005i-J8 for pgsql-general@lists.postgresql.org; Mon, 26 Apr 2021 15:14:42 +0200 Received: from c720-r368166.fritz.box (localhost [127.0.0.1]) by c720-r368166.unixarea.de (8.16.1/8.14.9) with ESMTPS id 13QDEfAu002730 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Mon, 26 Apr 2021 15:14:41 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by c720-r368166.fritz.box (8.16.1/8.14.9/Submit) id 13QDEfmO002729 for pgsql-general@lists.postgresql.org; Mon, 26 Apr 2021 15:14:41 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: c720-r368166.fritz.box: guru set sender to guru@unixarea.de using -f Date: Mon, 26 Apr 2021 15:14:40 +0200 From: Matthias Apitz To: pgsql-general@lists.postgresql.org Subject: Re: Invalid byte sequence when importing Oracle BLOB Message-ID: Reply-To: Matthias Apitz References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: FreeBSD 13.0-CURRENT r368166 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 188.174.57.250 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk El día lunes, abril 26, 2021 a las 06:49:18a. m. -0500, Ron escribió: > Hi, > > The source is an Oracle 12 db with this encoding: > NLS_LANG = AMERICAN_AMERICA.AL32UTF8 > NLS_NCHAR = AL32UTF8 > > The destination is an (RDS) Postgresql 12.5 with encoding UTF8, and is being > loaded through COPY commands generated by ora2pg. > > The source table has a BLOB column (I think they are scanned images) which > I'm loading into a Postgresql bytea column. > > Seven times out of about 60M rows, I get this error: > Psql:909242: ERROR:  invalid byte sequence for encoding "UTF8": 0xed 0xaf 0xbf This error can't be caused by a BLOB or bytea column. Only char or vchar columns can cause (and did cause) such errors in our Oracle/Sybase to PostgreSQL migrations. matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub