agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: Masashi Kamura (Fujitsu) <kamura.masashi@fujitsu.com>
Cc: 'pgsql-hackers@lists.postgresql.org' <pgsql-hackers@lists.postgresql.org>
Cc: Jeff Davis <pgsql@j-davis.com>
Subject: Re: Crash issue in PG18.5 regression
Date: Tue, 11 Aug 2026 08:32:15 +0200
Message-ID: <anq-x9lmTO-mKL_k@alvherre.pgsql> (raw)
In-Reply-To: <OS9PR01MB1317436E07D06281AD1A0452F94DD2@OS9PR01MB13174.jpnprd01.prod.outlook.com>

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)






view thread (16+ messages)  latest in thread

Message-ID: <anq-x9lmTO-mKL_k@alvherre.pgsql>
Permalink:  ../anq-x9lmTO-mKL_k@alvherre.pgsql/
Also on:    postgresql.org/message-id/anq-x9lmTO-mKL_k@alvherre.pgsql

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@kurilemu.de, kamura.masashi@fujitsu.com, pgsql-hackers@lists.postgresql.org, pgsql@j-davis.com
  Subject: Re: Crash issue in PG18.5 regression
  In-Reply-To: <anq-x9lmTO-mKL_k@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox