Re: BUG #18870: weird behavior with regexp_replace

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: devops(at)key2asset(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18870: weird behavior with regexp_replace
Date: 2025-03-27 21:23:58
Message-ID: 2153095.1743110638@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> select regexp_replace(LOWER('Örebro'), '\W', '_', 'g') in postgres 15 the
> result is örebro which is correct since ö should fit in the \w for a
> regex.
> select regexp_replace(LOWER('Örebro'), '\W', '_', 'g') --> since postgres 17
> the result is _rebro which is incorrect since \w should also contain
> characters like ö, ä, ë.

This most likely indicates that you've got a different database
collation selected in the v17 installation. Postgres defers to
the LC_CTYPE setting (or, in some configurations, the ICU collation)
to decide what is a letter. See

https://www.postgresql.org/docs/current/charset.html

psql's "\l" command will give a quick overview of what collations
you have selected.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Gustafsson 2025-03-27 22:49:49 Re: BUG #18845: DEREF_OF_NULL.RET guc_malloc possibly returns NULL
Previous Message Tom Lane 2025-03-27 16:01:13 Re: BUG #18866: Running pg_freespace() on views triggers an Abort