Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQQGv-007A8H-1F for pgsql-admin@arkaria.postgresql.org; Tue, 02 Dec 2025 13:18:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQQGt-007uey-37 for pgsql-admin@arkaria.postgresql.org; Tue, 02 Dec 2025 13:18:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with utf8esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQQE2-007pLV-24 for pgsql-admin@lists.postgresql.org; Tue, 02 Dec 2025 13:15:27 +0000 Received: from facteur.thefreecat.org ([88.198.1.27]) by magus.postgresql.org with utf8esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQQDv-002jrP-2k for pgsql-admin@lists.postgresql.org; Tue, 02 Dec 2025 13:15:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thefreecat.org; s=thefreecat; t=1764681317; bh=dzkms39btCGRq2o2zUETofbxnd37f7dx+afG3r/5uKI=; h=Date:Subject:To:References:From:In-Reply-To; b=Ap0Ih6eDCyDfcDWnYhW/U6Eu022YXR8OKM3CdY5jpqm8itYE6kA8D8YxUWDV7k8q1 JogSnO8UiC3GLRHAL6A9r4gaPkjPDcoAtGj84CO5TxReIN0p20gr36bAqhztECOn4V bBsMJryR+xBGGkrI7xrsk5NNZYSGOlz4moQt4lDBrvXcCeCGRw0qsonPiFmkU Original-Subject: Re: Importing a Windows database (in en_GB.CP1252) to linux Original-From: Jean-Christophe BOGGIO Received: from [192.168.1.182] (91-167-190-143.subs.proxad.net [::ffff:91.167.190.143]) (AUTH: LOGIN cat, TLS: TLS1.3,128bits,ECDHE_RSA_AES_128_GCM_SHA256) by facteur.thefreecat.org with ESMTPSA id 000000000DA26B6C.00000000692EE665.00125D30; Tue, 02 Dec 2025 14:15:16 +0100 Message-ID: <4856dd3a-f42b-48ce-8837-7792a1114206@thefreecat.org> Date: Tue, 2 Dec 2025 14:15:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Importing a Windows database (in en_GB.CP1252) to linux To: Laurenz Albe , "pgsql-admin@lists.postgresql.org" References: <5d7b5d51-a7c7-4cf2-943c-49b93441b8fa@thefreecat.org> <74bbf2e7-0120-4b77-96a6-e5d6f4d75619@thefreecat.org> From: Jean-Christophe BOGGIO Content-Language: en-US, fr In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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