Re: PostgreSQL JDBC Driver ERROR: invalid byte sequence for encoding "UTF8": 0x00 on Select stmt

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Hotmail <crajac66(at)hotmail(dot)com>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL JDBC Driver ERROR: invalid byte sequence for encoding "UTF8": 0x00 on Select stmt
Date: 2020-08-11 08:33:05
Message-ID: cf4966960fa6b5511535d5bc6ff4bf6c405b6d4e.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Sat, 2020-08-08 at 03:59 -0600, Hotmail wrote:
> We migrated data from Oracle to postgres using oracle_fdw without seeing any invalid byte
> sequence for encoding "UTF8": 0x00 errors. The data transfer from Oracle to Postgres using
> oracle_fdw completed successfully without any errors.
>
> After we started our application using Postgres as the new data source we are consistently
> seeing "invalid byte sequence for encoding "UTF8": 0x00 errors" once or twice a minute on
> a basic select statement like this:
>
> Select * from <table> where <col1>=‘foo’ and <col2>=‘foo2’;
>
> Not all queries fail just some. We can select * from the table in question from psql without
> any invalid byte sequence errors (A problem with the jdbc client maybe?)

oracle_fdw will complain about zero bytes, so odds are that your PostgreSQL database is fine.
This is confirmed by the face that "SELECT * FROM atable" works in PostgreSQL.

I can see two options:

1. The statement that causes the errors is actually a different statement, for
example an INSERT.

2. 'foo' and 'foo2' contain zero bytes.

Yours,
Laurenz Albe

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2020-08-11 15:28:05 Re: Postgresql background writer and checkpointer memory utilization in Linux server
Previous Message Rui DeSousa 2020-08-11 01:30:13 Re: Recovery from WAL archives not advancing timeline?