3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

COLLATE "ja_JP.utf8" asc が動かない

Last updated at Posted at 2019-08-11

問題

もともと postgres10.9 のイメージを使っていたが

COLLATE "ja_JP.utf8" asc

みたいな検索条件がある時に動かない。

解決方法

引っ張ってきたイメージには en_US.utf8 しかないので、下記の通り変える

変更前

docker-compose.yml
  pgsql:
    image: postgres10.9

変更後

docker-compose.yml
  pgsql:
    build: ./docker/db
./docker/db/Dockerfile
FROM postgres:10.9
RUN localedef -i ja_JP -c -f UTF-8 -A /usr/share/locale/locale.alias ja_JP.UTF-8
ENV LANG ja_JP.UTF-8

調べてた時の作業内容

localeコマンドを売ったら ja_jp.utf8 で設定されてない

root@cf87121a0be7:/# locale
LANG=en_US.utf8
LANGUAGE=
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=

local -a を打ったら ja_jp.utf8 がない

root@8dc095cd908f:/# locale -a
C
C.UTF-8
en_US.utf8
POSIX
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?