Re: Collation again here

Поиск
Список
Период
Сортировка
От Rihad
Тема Re: Collation again here
Дата
Msg-id 9f5996c1-abab-40da-8dd5-d56f483b22b1@gmail.com
обсуждение исходный текст
Ответ на Re: Collation again here  (Dominique Devienne <ddevienne@gmail.com>)
Ответы Re: Collation again here
Re: Collation again here
Список pgsql-general
On 1/8/26 4:48 PM, Dominique Devienne wrote:
On Thu, Jan 8, 2026 at 1:39 PM Rihad <grihad@gmail.com> wrote:
Hi, guys. Just pg_upgraded our PG from 13.x to 18.1, rebuilt all indexes concurrently and issued  ALTER DATABASE foo REFRESH COLLATION VERSION
Everything's fine on the master server, no warnings etc. Then I set up a replica using pg_basebackup, and there when trying to access the DB using psql I get:

WARNING:  database "foo" has a collation version mismatch
DETAIL:  The database was created using collation version 43.0, but the operating system provides version 34.0.
HINT:  Rebuild all objects in this database that use the default collation and run ALTER DATABASE foo REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
The OS are both FreeBSD, but the master runs 14.3, the replica runs 13.5. PostgreSQL packages are built with ICU support by default, the versions used are identical:  icu-76.1
Could it be that the OS (libc) needs to be the same version? I hoped it would be enough to use the same ICU.
Depends what Provider you used in those DBs:
https://www.postgresql.org/docs/current/locale.html#LOCALE-PROVIDERS
Having the same ICU is good, but do your DBs use that provider? If
not, and you're using the libc one, then yes, the libc version
matters.
Myself I use the new builtin provider to avoid OS portability issues. --DD

Hi, our locale/collate/whatever is  en_US.UTF-8 (as set by these pg_upgrade flags: --encoding=utf-8 --locale=en_US.UTF-8)



Looking into pg_collation system table that collation has collprovide="c". First I thought "c" meant libc, but this article states that "c" means PG Internal provider, and libc would have been "l".

https://medium.com/@adarsh2801/understanding-collations-in-postgresql-648e4fa333e1

  1. PostgreSQL Internal Provider (‘c’) : Introduced in Postgres 15. This built-in collation support is System/OS agnostic.
  2. System Library Provider (‘l’) : Uses GNU C library and hence is OS locale dependent.
  3. ICU — International Components for Unicode (‘i’) : Uses ICU library for unicode-aware collation.


We only have "i" & "c" in pg_collation. And we aren't using any of "i" it seems. All this locale/encoding/collate stuff is too much for me to handle, sorry)

So if we are using the internal (builtin) "c" provider how come the PG 18.1 run on FreeBSD 13.5 version shows warnings that the system version is 34.0?

The article must be wrong I guess.

Then upgrading 13.5 to 14.3 is our only option.

В списке pgsql-general по дате отправления: