Re: BUG #18196: Databases Created in Turkish Language Will Not Run on the Latest Version of Windows

From: Halil Han Badem <halilhanbadem(at)gmail(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18196: Databases Created in Turkish Language Will Not Run on the Latest Version of Windows
Date: 2023-11-15 18:11:32
Message-ID: CA+hfYg-rGc-O_LnS5M59HGbYufaGsQ6Sc4yBKucBQZLhoZE_7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I can convey it to you in more detail. Now I will explain the steps to
avoid repeating this error.

1. Obtain a Windows version prior to version 22H2 22621.2715.
2. During the PostgreSQL installation in that version, choose Turkish,
Turkey as the locale (during installation).
3. Create a database using PgAdmin or any other tool and select
Turkish_Turkey.1254 as the local option.
4. Update your operating system to version 22H2 22621.2715.
5. After updating the operating system and restarting, you will notice that
the PostgreSQL service is not running.
6. When you try to start the service, you will encounter an error stating
that the Windows service cannot be started.
7. Later, in the Windows Event Logs, you will see the error "2023-11-15
10:47:14.877 +03 [1644] FATAL: configuration file "C:/Program
Files/PostgreSQL/15/data/postgresql.conf" contains errors."
8. The cause of the error in this file is the values specified as
lc_messages, lc_monetary, lc_numeric, lc_time under Turkish_Turkey.1254.
This is because, with the new update, Turkish_Turkey.1254 is no longer
present in the Windows operating system; the correct locale name is now
Turkish_Türkiye.1254.

In this case, the solution I implemented was as follows:
1. I copied the existing "data" folder of the database.
2. I obtained a Windows version with a lower version number than 22H2
22621.2715.
3. I defined the "data" folder for the PostgreSQL server in the relevant
version and restarted the services.
4. I accessed the database, took a backup.
5. I reinstalled PostgreSQL on the problematic server.
6. I restored the backup to the server. Before restoring, I marked the
local option for the created database as "C". This option worked smoothly
and did not cause any data loss.

Note: After updating Windows, if you reinstall PostgreSQL, you will see
that all Turkish_Turkey.1254 values in the postgresql.conf file have
changed to Turkish_Türkiye.1254. If you manipulate the value in this file
(try changing it back to Turkish_Turkey.1254), you will encounter the error
`The database was initialized with LC_COLLATE “Turkish_Turkey.1254”, which
is not recognized by setlocale()` because Turkish_Turkey.1254 locale no
longer exists; its name has been changed.

The decision of Windows to update in this regard will be a bad experience
for users in Turkey or anyone using the Turkish language option. I hope the
instant solution I found is helpful. I sincerely look forward to any
permanent solutions you may find.

Best regards.

Halil Han BADEM
Yazılım & Sistem Uzmanı
[image: linkedin icon] <https://tr.linkedin.com/in/halilhanbadem> [image:
instagram icon] <https://www.instagram.com/halilhanbadem.dev/>
E-Posta: halilhanbadem(at)gmail(dot)com | work(at)halilhanbadem(dot)dev
VD. - VNo.: 1290500711 - HİTİT | Telefon: (850) 309 4875
Balgat Mahallesi, Ceyhun Atuf Kansu Caddesi 36/6 06520, Çankaya, Ankara

Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, 15 Kas 2023 Çar, 20:48 tarihinde
şunu yazdı:

> On Wed, 2023-11-15 at 09:04 +0000, PG Bug reporting form wrote:
> > Operating system: Windows 11 22H2 22621.2715
> >
> > This morning, I noticed that my computer at the office and my computer at
> > home had received automatic updates. Subsequently, I received reports of
> > some errors. Upon investigation, I found that the PostgreSQL service was
> not
> > running, and the error indicated that it was due to a problem in the
> > postgresql.conf file. After extensive research, I discovered that in the
> > Windows 11 22H2 22621.2715 update, the term "Turkey" had been changed to
> > "Türkiye." As a result, Turkish_Turkey.1254 is no longer present in the
> > operating system. Instead of Turkish_Turkey.1254, the Windows system now
> > uses Turkish_Türkiye.1254.
> >
> > Databases created with Turkish_Turkey.1254 cannot find the corresponding
> > locale, resulting in errors and service disruptions. After a fresh
> > installation, I observed the following expressions in the postgresql.conf
> > file.
> >
> > # These settings are initialized by initdb, but they can be changed.
> > lc_messages = 'Turkish_Türkiye.1254' # locale for
> system error message
> > # strings
> > lc_monetary = 'Turkish_Türkiye.1254' # locale for
> monetary formatting
> > lc_numeric = 'Turkish_Türkiye.1254' # locale for
> number formatting
> > lc_time = 'Turkish_Türkiye.1254' # locale
> for time formatting
> >
> > Therefore, there is a conflict, and I request your assistance in
> addressing
> > this matter.
>
> This has been reported before [1], but your report explains the problem
> clearly.
>
> Can you show the exact error message?
>
> This seems to be a really nasty problem that Microsoft has created for us.
> Even if the server started, you could not connect to the database if the
> collation persisted in pg_database is no longer accepted by the operating
> system.
>
> I cannot think of a possible solution except a hard-coded hack specifically
> for Turkish locale names...
>
> Yours,
> Laurenz Albe
>
>
> [1]: https://postgr.es/m/18181-fa5143d18a467fe5%40postgresql.org
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dean Rasheed 2023-11-15 18:14:41 Re: BUG #18200: Undefined behaviour in interval_div
Previous Message Laurenz Albe 2023-11-15 18:08:51 Re: LIMIT clause extremely slow