pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Invalid byte sequence when importing Oracle BLOB
Date: Mon, 26 Apr 2021 17:19:12 +0200
Message-ID: <3762f2cd801291ce2092138dcc8db01f64d60082.camel@cybertec.at> (raw)
In-Reply-To: <d32bf7b4-88fb-96f2-6627-82a78f091e4f@gmail.com>
References: <d32bf7b4-88fb-96f2-6627-82a78f091e4f@gmail.com>

On Mon, 2021-04-26 at 06:49 -0500, Ron wrote:
> 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
> 
> Is there anything I can change on the Postgresql side to make these records 
> import correctly?

The "bytea" column is probably a red herring - this error message should
be caused by a "text" or "varchar" or other string data column.

It is surprisingly easy to enter currupt strings into Oracle - just set
client encoding to the same value as server encoding, and it won't check
the integrity of your strings.

If that is your problem, you must identify and fix the data in Oracle.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (7+ messages)

Message-ID: <3762f2cd801291ce2092138dcc8db01f64d60082.camel@cybertec.at>
Permalink:  ../3762f2cd801291ce2092138dcc8db01f64d60082.camel@cybertec.at/
Also on:    postgresql.org/message-id/3762f2cd801291ce2092138dcc8db01f64d60082.camel@cybertec.at

 · 

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: laurenz.albe@cybertec.at, ronljohnsonjr@gmail.com
  Subject: Re: Invalid byte sequence when importing Oracle BLOB
  In-Reply-To: <3762f2cd801291ce2092138dcc8db01f64d60082.camel@cybertec.at>
  References: <d32bf7b4-88fb-96f2-6627-82a78f091e4f@gmail.com> <3762f2cd801291ce2092138dcc8db01f64d60082.camel@cybertec.at>

* 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