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.94.2) (envelope-from ) id 1u21rU-00BqQj-Ri for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Apr 2025 05:51:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u21rS-0065n5-RN for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Apr 2025 05:51:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u21rS-0065mx-GY for pgsql-bugs@lists.postgresql.org; Tue, 08 Apr 2025 05:51:02 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u21rQ-0044Q1-0o for pgsql-bugs@lists.postgresql.org; Tue, 08 Apr 2025 05:51:02 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-43cf58eea0fso26170065e9.0 for ; Mon, 07 Apr 2025 22:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1744091458; x=1744696258; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=9xgeyxZA2mPwFVwDWAZCVlPf7vOIuBwtkPOS2aGTqNk=; b=QU0KxCeqJdT7xjx7Jc39Z1fgAhBUMMzTf4XGhdpgavM1KdZmg52uXk4EZPrbviC42Z klI+6r4ZES6NOUMjI6TYqD0yw1g/EzhYPQfmU4WnwSxfDkycyMAbM84AAwhcb8xbFVMu 6JbGhJ8uaZ8KIbvt2UZb17FZEj9HPEfoIpTN3vN+iZibrcfNC8KrHgV5qFcVFPEyxgQO n9cvbB1EJGpsWP0XV7qcx21qNeNxc4dDmyxXpCJh8hNo52THkdJQIhrAuUmAWvsnVaB1 3lJ7VaEXi7l8DbHVTTHQ2KY0Bfy5c4/aCiKZxHXKoDBRttlaSFZRRJ51LOYCcX0KuW8O mcmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744091458; x=1744696258; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9xgeyxZA2mPwFVwDWAZCVlPf7vOIuBwtkPOS2aGTqNk=; b=QVcHuFbomnTrjZlF7tpqps9sOX4T76jsnCa2xWVLYc+D+vhHnuqlcDM0ZhaXeQN6kd HQbzuK+B8DuZhbXkCIxnPy3PSxQDz6xosmgMlZRonpPyMnNm7BRlsiy2RlaZ2xb82h1H Va5fVV1wmHG3xTHEGHgLqSMAA4rMNEQxSfYGXS4K8e7j8ohNR+d/RjOhnxtGrnv64NUu EvXh0rlxcI1dZUe1qvnf6BGgp7iH9cXcNnLAlVyQLt6x/ctmufHw4P8lfQ5Yd64o44Eg NK8lNFHw6JBGaSI4ikEIH9Jvf+tmORyYBKFeGPzbVcqYVk9LUQeqlqF+hwXiIZQiX9vY x6IA== X-Forwarded-Encrypted: i=1; AJvYcCXUBly8Nc3qLfShPN5SGak6o0A7YcSa1LC//0uahyvyN8F3vkPs6su9SBddt8LTcqDA2icrfnV4n/Kn@lists.postgresql.org X-Gm-Message-State: AOJu0YygkTEyFJ2/R7VY0PaTMmVkg5yvY2iDJl3masxKw+GCDmov912q qXVSsmkmi9s9UOqmwZXHmBK0jsER36fAEjrU8pkdvQvYBlfOukR7NTZyUIoO8LajckKVRDpjJoG az/1itw== X-Gm-Gg: ASbGncumg3b7IR7K+ysEzqqiW+uIjU02GnTHlDmO2vjVMhvhjnKQ5sNA97GxkjwVgi2 l4HsGkUCE2DnKXVu8K8ecELAD3nqbaPBdEE3gP5SaC+E5HsVa5KgJlSusUV788L2rLv9LqrpXTh lf5PifbZmkKa/OJcB2hJPO2XmOYFDIlxQqILMm+XY5wpfbwIfR4W8BVufDbQq7jccMc+N5Z54VA loZE/GSYCsJKr6K8v4awK2rq34X0spTwtskb4vXGLbhKZ9MIOnZmmt4p2DBhHgmIJHEY1JgfA+F iI5PMojSuQMAUyYxkQMmiFqNwFyZ1Uutn9DeMg7HtfYT6kxY39Bu8O8Nrnv2NA== X-Google-Smtp-Source: AGHT+IH4YqNSTA/6IpbXqkZq/ZVQzsQizkGGbyieO5YRQFffaSneBNX/hqTzKXB/+e0bXX6kh45ekg== X-Received: by 2002:a05:600c:35c5:b0:43b:cc3c:60bc with SMTP id 5b1f17b1804b1-43ecf8cfb86mr154956925e9.15.1744091458415; Mon, 07 Apr 2025 22:50:58 -0700 (PDT) Received: from localhost.localdomain ([41.66.99.137]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43ec34a8952sm149438075e9.10.2025.04.07.22.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Apr 2025 22:50:58 -0700 (PDT) Message-ID: Subject: Re: PostgreSQL v15.12 fails to perform PG_UPGRADE from v13 and v9 on Windows From: Laurenz Albe To: Avi Uziel , Manika Singhal Cc: Ben Caspi , pgsql-bugs@lists.postgresql.org, Liran Amrani , Shahar Amram , Sandeep Thakkar , thomas.munro@gmail.com, tgl@sss.pgh.pa.us Date: Tue, 08 Apr 2025 07:50:56 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2025-04-07 at 17:59 +0300, Avi Uziel wrote: > On Fri, Apr 4, 2025 at 3:30=E2=80=AFPM Manika Singhal wrote: > > On Fri, Mar 21, 2025 at 4:43=E2=80=AFPM Ben Caspi wrot= e: > > > We have an environment with numerous client Windows machines. The mac= hines have PSQL v9.6/v13.13/v15.6 installed. > > >=20 > > > However, running PG_UPGRADE on PSQL v9.6/13.13 to v15.12 has been fai= ling. > > >=20 > > > This is the error message: > > > lc_collate values for database "template1" do not match: =C2=A0old "E= nglish_United States.1252", new "en-US" > > >=20 > > > Upon investigation, we came to understand that the PSQL v9.6/v13.13 c= onfig contains the following configuration by default: > > > lc_messages =3D 'English_United States.1252' > > > lc_monetary =3D 'English_United States.1252' > > > lc_numeric =3D 'English_United States.1252' > > > lc_time =3D 'English_United States.1252' > > >=20 > > > But when installing PSQL 15.12 it's changed to: > > > lc_messages =3D 'en-US' > > > lc_monetary =3D 'en-US' > > > lc_numeric =3D 'en-US' > > > lc_time =3D 'en-US' > >=20 > > This change in the behaviour of the installer is the result of this com= mit [1]. > >=20 > > =C2=A0As a part of this change, the installer would convert the chosen = locale to its corresponding BCP-47 > > [2] code name before passing it on to initdb.exe. This was helpful for = users where the locale name > > contained non-ascii characters and initdb would fail. We received a sig= nificant number of tickets > > from users after Microsoft made that change (to add non-ascii character= s) in their updates. > >=20 > > Reading the thread [3], it seems it's probably not recommended to updat= e the=C2=A0pg_database.datcollate > > or=C2=A0datctype. I am thinking if it might help if installer converted= the chosen locale name to BCP-47 only > > when it contains non-ascii characters, otherwise, it should use the nam= e as is during initdb run. > > Will this help? > >=20 > > [1]https://github.com/EnterpriseDB/edb-installers/commit/e6404b5194051e= 20cfc0e7f268a69091e6445a73 > > [2]https://www.postgresql.org/message-id/CA%2BhUKGL5mBN3JQuebAPbX0yxDNt= pui04J%2BKSy2F7KBbhLGaJig%40mail.gmail.com > > [3]https://www.postgresql.org/message-id/2694195.1700072765%40sss.pgh.p= a.us > > I anticipate that users could face an upgrade issue if they installed a c= luster on a Windows > machine using the default locale before this change and then attempt to u= pgrade to a release > that includes this commit. Yes, I think this will cause more trouble. I think that we should stick with BCP-47 locale names as much as possible. = The problem with the long locale names is not only non-ASCII characters, but that Microsoft = keeps changing these names, and PostgreSQL persists them in the catalog, which causes trouble if= Windows is upgraded. I can see three potential ways to deal with that: 1. Only when creating a cluster for upgrade, use the locale names that the = old cluster uses. That is difficult, because it requires to connect to that cluster, as th= e information is only in catalog tables. Also, if there are several clusters, which one = to use? 2. Before upgrading a cluster, update the catalog tables of the old cluster= with the corresponding BCP-47 name. That would be a good way into a world with only BCP-47 locale names. On the one hand, it would be convenient to have pg_upgrade do this autom= atically, but if the upgrade fails for whatever reason, your original cluster got modifie= d, which doesn't feel right. Perhaps the Windows binaries could come with an extra tool for such a ch= ange, and perhaps the installer could suggest running it before an upgrade. 3. A minimal solution would be to equip the Windows installer with some gui= dance for the user at the point where the locale is chosen. The BCP-47 locale name would b= e suggested, and a text could point out "If you plan to upgrade a cluster that was create= d with long locale names, please select the same locale names for the new cluster". I would like #2, but I cannot tell how easy or feasible it would be. Yours, Laurenz Albe