Re: Importing a Windows database (in en_GB.CP1252) to linux
| От | Jean-Christophe BOGGIO |
|---|---|
| Тема | Re: Importing a Windows database (in en_GB.CP1252) to linux |
| Дата | |
| Msg-id | 4856dd3a-f42b-48ce-8837-7792a1114206@thefreecat.org обсуждение исходный текст |
| Ответ на | Re: Importing a Windows database (in en_GB.CP1252) to linux (Laurenz Albe <laurenz.albe@cybertec.at>) |
| Список | 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
В списке pgsql-admin по дате отправления: