Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4HQc-00072x-Ej for pgsql-general@arkaria.postgresql.org; Thu, 23 Jun 2022 07:39:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o4HPd-0006cj-CL for pgsql-general@arkaria.postgresql.org; Thu, 23 Jun 2022 07:38:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4HPd-0006cU-28 for pgsql-general@lists.postgresql.org; Thu, 23 Jun 2022 07:38:01 +0000 Received: from brisi.sourcepole.ch ([5.9.57.43]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o4HPa-0006jF-SQ for pgsql-general@lists.postgresql.org; Thu, 23 Jun 2022 07:38:00 +0000 Received: from [213.55.224.206] (helo=[192.168.43.81]) by vilan-mail with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o4HPZ-0000rm-Ie for pgsql-general@lists.postgresql.org; Thu, 23 Jun 2022 09:37:57 +0200 Message-ID: <06131c03-5dd1-a8e1-37ea-65014470c22e@sourcepole.ch> Date: Thu, 23 Jun 2022 09:37:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: ERROR: new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf-8) Content-Language: en-GB From: Tomas Pospisek To: pgsql-general@lists.postgresql.org References: <8c998edf-82a1-0769-77d7-7ef5076c098c@aklaver.com> 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 On 22.06.22 22:18, Tomas Pospisek wrote: > On 22.06.22 21:25, Adrian Klaver wrote: >> On 6/22/22 12:17, Tomas Pospisek wrote: >>> Hi all, >>> >>> while doing `cat pg_dump.dump | psql` I get the above message. Note >>> that `pg_dump.dump` contains: >>> >>>      CREATE DATABASE some_db WITH TEMPLATE = my_own_template ENCODING >>> = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8'; >>> >>> What is exactly the problem? I understand that en_US.UTF-8 and >>> en_US.utf-8 is not *exactly* the same string. >>> >>> However I do not understand how the difference came to be. And I do >>> not know what the "right" way is and how to proceed from here. >>> >>> If I `pg_dump --create` some DB on the new server >>> (13.7-1.pgdg18.04+1) I get: >>> >>>      CREATE DATABASE ... ENCODING = 'UTF8' LOCALE = 'en_US.utf-8'; >>> >>> When I do the same on the old server (12.8-1.pgdg20.04+1) I get: >>> >>>      CREATE DATABASE ... ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' >>> LC_CTYPE = 'en_US.UTF-8'; >>> >>> Any hints or help? >> >> Are dumping/restoring from one version of Postgres to another? > > Yes, indeed! > >> If from older to newer then use the new version of pg_dump(13) to dump >> the older(12) database. Then the 13 version of restore to load the >> version 13 database. > > I will. Thanks a lot Adrian! So I used both pg_dump and pg_restore from the newer machine. Result is still the same. So I'll use Tom Lane's suggestion too and fix the 'UTF-8' spelling in the dump file: Tom Lane wrote: > This is probably more about dumping from different operating systems. > The spelling of the locale name is under the control of the OS, > and Postgres doesn't know very much about the semantics of it > (so I think we conservatively assume that any difference in > spelling is significant). > > Best bet might be to edit the dump file to adjust the locale > spellings to match your new system. Many thanks to both Tom & Adrian!!! *t