| 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 09:39:04 |
| Message-ID: | 74bbf2e7-0120-4b77-96a6-e5d6f4d75619@thefreecat.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
Laurenz,
> That looks like pg_restore sets a wrong client_encoding, which is weird.
>
> What do you get for
>
> pg_restore -p 5433 -t csakafl -s -f - imlocal20251127.backup | grep client_encoding
SET client_encoding = 'UTF8';
> If the dump was taken from a WINDOWS-1252 encoded database, that line should
> read
>
> SET client_encoding = 'WIN1252';
>
> and everything should work fine. But apparently, the client_encoding is set to
> UTF-8 in your case.
Yes, exactly.
> How did that happen? How exactly did you take that dump?
This backup is a transfer from an iSeries DB2 database. It has been a
nightmare to get this working (and took around 10 days to finalize). We
set up a FDW Server using odbc_fdw, recreated all the tables (around 2k)
and INSERTed the DB2 data to the PG tables.
Then we used PgAdmin that came with PostgreSQL 17 on the Windows machine.
I double-checked with the client: the database is in en_GB.CP1252.
BTW, if I try to import the same backup on a UTF8 database I get the
exact same error (invalid byte sequence 0x92)
> Did you do anything (like an encoding conversion) with the dump after you took it?
No, the backup is in custom format so I can't touch it (or at least I
don't know how I could).
Where can I go from here?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Laurenz Albe | 2025-12-02 11:26:54 | Re: Importing a Windows database (in en_GB.CP1252) to linux |
| Previous Message | Laurenz Albe | 2025-12-01 15:07:30 | Re: Importing a Windows database (in en_GB.CP1252) to linux |