If the dump file is too big to edit conventionally, piping it through a stream editor like sed to make the required changes works nicely. It can be done on the fly in the restore process if required.
Brent Wood Principal Technician, Fisheries NIWA DDI: +64 (4) 3860529 ________________________________ From: Tom Lane <[email protected]> Sent: Monday, 24 November 2025 11:02 To: Ertan Küçükoglu <[email protected]> Cc: [email protected] <[email protected]> Subject: Re: Restore Windows dump to Linux (locale issue) =?UTF-8?B?RXJ0YW4gS8O8w6fDvGtvZ2x1?= <[email protected]> writes: > I am using PostgreSQL 18.1 on a Windows system. > I need to move that database to a Linux system of the same version number. > Windows system use locales name as tr-TR (this is UTF-8 locale) > Linux system use locale name as tr_TR.UTF-8 > My cluster backup gives error at restore (I think because of that locale > naming difference) as below > psql:/db.dump:133: ERROR: invalid LC_COLLATE locale name: "tr-TR" Edit the dump so that the databases are created with Linux-compatible locale names. You should find lines like CREATE DATABASE foo WITH TEMPLATE = template0 ENCODING = 'UTF-8' LOCALE_PROVIDER = libc LOCALE = 'tr-TR'; (details will vary depending on PG version) and changing the locale strings ought to do the trick. If the dump file is too big for your editor, consider splitting it into schema-only and data-only dumps. regards, tom lane Brent Wood Principal Technician - GIS and Spatial Data Management +64-4-386-0529 301 Evans Bay Parade, Greta Point, Hataitai, Wellington, New Zealand Earth Sciences New Zealand [Earth Sciences New Zealand]<https://earthsciences.nz> The Institute of Geological and Nuclear Sciences Limited and the National Institute of Water and Atmospheric Research Limited joined to become the New Zealand Institute for Earth Science Limited. We are known as Earth Sciences New Zealand. For more information on the Earth Sciences transition click here<https://niwa.co.nz/about-niwa/science-sector-reforms>. Notice: This email may contain information which is confidential and/or subject to copyright, and may not be used, published or redistributed without the prior written consent of Earth Sciences New Zealand. If you are not the intended recipient, please immediately notify the sender and delete the email and any attachments. Any opinion or views expressed in this email are those of the individual sender and may not represent those of Earth Sciences New Zealand. For information about how we process data and monitor communications please see our privacy policy<https://niwa.co.nz/about-niwa/privacy-policy>.
