| From: | Jean-Christophe BOGGIO <postgresql(at)thefreecat(dot)org> |
|---|---|
| To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Importing a Windows database (in en_GB.CP1252) to linux |
| Date: | 2025-12-02 13:15:15 |
| Message-ID: | 4856dd3a-f42b-48ce-8837-7792a1114206@thefreecat.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Raj | 2025-12-02 19:48:54 | Re: Migration from MSSQL to POSTGRESQL |
| Previous Message | Laurenz Albe | 2025-12-02 11:26:54 | Re: Importing a Windows database (in en_GB.CP1252) to linux |