On 2026-Aug-11, Masashi Kamura (Fujitsu) wrote:
> Hi,
>
> We found that the program crashes when following the steps below.
>
> 1) Create the instance
> initdb -D data --encoding=UTF8 --no-locale
>
> 2) Execute following SQL
> SELECT to_date('01 ŞUB 2010', 'DD TMMON YYYY');
>
> We are analyzing the cause and the following commit seems the cause.
> https://github.com/postgres/postgres/commit/011384ba45f
>
> Could you please check this?
I confirm that this crashes with my regular build options also, as long
as initdb --no-locale is used. The backtrace from the crash point is
#0 __GI___towupper_l (wc=74, locale=locale@entry=0x0) at
./wctype/wcfuncs_l.c:69
#1 0x0000563291e315b8 in strupper_libc_mb (dest=0x7ffe3664f100 "\002",
destsize=80, src=0x5632b0c066d8 "Jan",
srclen=3, locale=0x5632b0c02898) at
../../source/REL_18_STABLE/src/backend/utils/adt/pg_locale_libc.c:398
#2 strupper_libc (dst=dst@entry=0x7ffe3664f100 "\002",
dstsize=dstsize@entry=80, src=src@entry=0x5632b0c066d8 "Jan",
srclen=<optimized out>, locale=locale@entry=0x5632b0c02898)
at ../../source/REL_18_STABLE/src/backend/utils/adt/pg_locale_libc.c:147
#3 0x0000563291e2f029 in pg_strupper (dst=dst@entry=0x7ffe3664f100 "\002",
dstsize=dstsize@entry=80,
src=src@entry=0x5632b0c066d8 "Jan", srclen=<optimized out>,
locale=locale@entry=0x5632b0c02898)
at ../../source/REL_18_STABLE/src/backend/utils/adt/pg_locale.c:1325
The relevant code in src/backend/utils/adt/pg_locale_libc.c's
strupper_libc_mb() from frame 1 is
397 │ for (curr_char = 0; workspace[curr_char] != 0; curr_char++)
398 │ workspace[curr_char] = towupper_l(workspace[curr_char], loc);
where the important detail is that 'loc' is 0, which is not a valid
locale handle.
The locale code is quite the maze, but I'll see if I can find why is the
locale object not initialized.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Maybe there's lots of data loss but the records of data loss are also lost.
(Lincoln Yeoh)