File: articles/postgresql17-initdb-option.md2.3Kmarkdown
---
date: tags: [#postgresql]
---
PostgreSQL17でオプションなしでpostgresql-setupしたときと`--locale-provider=icu --icu-locale=ja-JP`指定のときの初期状態のデータベース比較
ただのメモ、備忘録です。
環境はAmazon Linux 2023です。
sudo dnf install -y postgresql17 postgresql17-serverでインストールした状態です。
sudo /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)
今度は
sudo 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: