pgcopydb icon indicating copy to clipboard operation
pgcopydb copied to clipboard

Invalid byte sequence for encoding "UTF8"

Open VaibhaveS opened this issue 6 months ago • 0 comments

pgcopydb assumes that the data is in UTF-8. With a setup like below pgcopydb clone would fail while COPYing.

1. CREATE DATABASE source with encoding 'SQL_ASCII' WITH template0;
2. \c source 
3. CREATE TABLE foo(t TEXT);
4. SET CLIENT_ENCODING = 'SQL_ASCII';
5. INSERT INTO foo VALUES(E'\377');

Since client_encoding is given as utf8 in the COMMON_GUC_SETTINGS, we need to change it according to the one in source.

source=# set client_encoding = 'utf8';
SET
source=# select * from foo;
ERROR:  invalid byte sequence for encoding "UTF8": 0xf

VaibhaveS avatar Aug 27 '24 08:08 VaibhaveS