PostgreSQL17でオプションなしでpostgresql-setupしたときと`--locale-provider=icu --icu-locale=ja-JP`指定のときの初期状態のデータベース比較

PostgreSQL17でオプションなしでpostgresql-setupしたときと`--locale-provider=icu --icu-locale=ja-JP`指定のときの初期状態のデータベース比較

ただのメモ、備忘録です。

環境はAmazon Linux 2023です。

sh
1sudo dnf install -y postgresql17 postgresql17-server

でインストールした状態です。

sh
1sudo /usr/bin/postgresql-setup --initdb

した場合

postgres=# \l
                                                 List of databases
   Name    |  Owner   | Encoding | Locale Provider | Collate |  Ctype  | Locale | ICU Rules |   Access privileges
-----------+----------+----------+-----------------+---------+---------+--------+-----------+-----------------------
 postgres  | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |        |           |
 template0 | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |        |           | =c/postgres          +
           |          |          |                 |         |         |        |           | postgres=CTc/postgres
 template1 | postgres | UTF8     | libc            | C.UTF-8 | C.UTF-8 |        |           | =c/postgres          +
           |          |          |                 |         |         |        |           | postgres=CTc/postgres
(3 rows)

今度は

sh
1sudo PGSETUP_INITDB_OPTIONS="--locale-provider=icu --icu-locale=ja-JP" /usr/bin/postgresql-setup --initdb

でICUでロケールをja-JP指定した場合

postgres=# \l
                                                 List of databases
   Name    |  Owner   | Encoding | Locale Provider | Collate |  Ctype  | Locale | ICU Rules |   Access privileges
-----------+----------+----------+-----------------+---------+---------+--------+-----------+-----------------------
 postgres  | postgres | UTF8     | icu             | C.UTF-8 | C.UTF-8 | ja-JP  |           |
 template0 | postgres | UTF8     | icu             | C.UTF-8 | C.UTF-8 | ja-JP  |           | =c/postgres          +
           |          |          |                 |         |         |        |           | postgres=CTc/postgres
 template1 | postgres | UTF8     | icu             | C.UTF-8 | C.UTF-8 | ja-JP  |           | =c/postgres          +
           |          |          |                 |         |         |        |           | postgres=CTc/postgres
(3 rows)

オプションを指定すると、Locale ProviderがicuになりLocaleにもちゃんとja-JPと示されている。
未指定だとLocale Providerはlibcになるようでした。

Share this post