pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Invalid byte sequence when importing Oracle BLOB
Date: Mon, 26 Apr 2021 07:45:26 -0500
Message-ID: <d5310e6f-4d0d-bc75-dfbc-a6bd9a3419ad@gmail.com> (raw)
In-Reply-To: <20210426123259.GB26434@hjp.at>
References: <d32bf7b4-88fb-96f2-6627-82a78f091e4f@gmail.com>
	<20210426123259.GB26434@hjp.at>

On 4/26/21 7:32 AM, Peter J. Holzer wrote:
> On 2021-04-26 06:49:18 -0500, Ron wrote:
>> 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
> Decoding UTF8 doesn't make sense for a bytea column. How does that data
> look like in the file generated by ora2pg?

I thought it was weird, too, but COPY has to read text, no?

Anyway, here are the first 8 lines (beware line wrapping) of the input file:

SET client_encoding TO 'UTF8';
SET synchronous_commit TO off;
SET search_path = strans,public;

TRUNCATE TABLE mv_response_attachment_old;

COPY mv_response_attachment_old 
(response_attachement_id,binary_data,employer_response_id,attachment_id_code,file_type,attachment_desc,attachment_size,file_name,partition_date,prior_incident_id,part_date) 
FROM STDIN;
1583201 \\x255044462d312e330d25e2e3cfd30d0a31362030206f...

It looks like a bog-standard COPY command, with which I've imported a lot of 
data.

-- 
Angular momentum makes the world go 'round.





view thread (7+ messages)  latest in thread

Message-ID: <d5310e6f-4d0d-bc75-dfbc-a6bd9a3419ad@gmail.com>
Permalink:  ../d5310e6f-4d0d-bc75-dfbc-a6bd9a3419ad@gmail.com/
Also on:    postgresql.org/message-id/d5310e6f-4d0d-bc75-dfbc-a6bd9a3419ad@gmail.com

 · 

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-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Invalid byte sequence when importing Oracle BLOB
  In-Reply-To: <d5310e6f-4d0d-bc75-dfbc-a6bd9a3419ad@gmail.com>
  References: <d32bf7b4-88fb-96f2-6627-82a78f091e4f@gmail.com> <20210426123259.GB26434@hjp.at> <d5310e6f-4d0d-bc75-dfbc-a6bd9a3419ad@gmail.com>

* 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