public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jean-Christophe BOGGIO <[email protected]>
To: Laurenz Albe <[email protected]>
To: [email protected] <[email protected]>
Subject: Re: Importing a Windows database (in en_GB.CP1252) to linux
Date: Tue, 2 Dec 2025 14:15:15 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

Laurenz,

Thanks a lot for your quick reply.

Le 02/12/2025 à 12:26, Laurenz Albe a écrit :
>> I double-checked with the client: the database is in en_GB.CP1252.
> The DB2 database or the PostgreSQL database?
>
> It must be the DB2 database, because otherwise the dump would contain

No: the PostgreSQL one. I guess the DB2 is encoded (internally) in 
EBCDIC... Yes... At least that's what CSV exports directly made from the 
DB shows.

> My best guess is that odbc_fdw has a bug that does not check if the strings are
> properly encoded, and you somehow got corrupted data in your PostgreSQL database.
> But I am not sure.

I don't know really but I could have the client do some tests on tables 
that we know contain invalid byte sequences. Maybe I could try doing 
manual pg_dumps with different -E parameter to verify that it's not 
something enforced by pgAdmin.

> You can try the following:
>
> - convert the custom format dump into an SQL script with
>
>    pg_restore -f script.sql imlocal20251127.backup
>
> - edit script.sql and change the line to read
>
>    SET client_encoding = 'WIN1252';
>
> - restore that dump with "psql":
>
>    psql -f script.sql -d newdb
>
> That should work if *all* the strings are in WINDOWS-1252 encoding.

Thanks a lot for the proposal. It seems to be doing the job!

It's running right now and so far no "bad encoding" error appeared (it's 
a 311Gb backup so it will take some time). I'll let you know.

Gratefully,

JC








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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Importing a Windows database (in en_GB.CP1252) to linux
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox