| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | "Masashi Kamura (Fujitsu)" <kamura(dot)masashi(at)fujitsu(dot)com> |
| Cc: | "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Jeff Davis <pgsql(at)j-davis(dot)com> |
| Subject: | Re: Crash issue in PG18.5 regression |
| Date: | 2026-08-11 06:32:15 |
| Message-ID: | anq-x9lmTO-mKL_k@alvherre.pgsql |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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(at)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(at)entry=0x7ffe3664f100 "\002", dstsize=dstsize(at)entry=80, src=src(at)entry=0x5632b0c066d8 "Jan",
srclen=<optimized out>, locale=locale(at)entry=0x5632b0c02898)
at ../../source/REL_18_STABLE/src/backend/utils/adt/pg_locale_libc.c:147
#3 0x0000563291e2f029 in pg_strupper (dst=dst(at)entry=0x7ffe3664f100 "\002", dstsize=dstsize(at)entry=80,
src=src(at)entry=0x5632b0c066d8 "Jan", srclen=<optimized out>, locale=locale(at)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)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chengpeng Yan | 2026-08-11 06:34:12 | Re: arrays over initdb-created types are broken after pg_upgrade |
| Previous Message | shveta malik | 2026-08-11 06:16:11 | Re: [PATCH] Release replication slot on error in SQL-callable slot functions |