0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

HerokuのPostgresで日本語のソートがおかしい

Posted at

日本語のソートしたいカラムに照合順序をつける

書式:

ALTER TABLE テーブル名 ALTER COLUMN カラム TYPE タイプ名 COLLATE "ja-x-icu"; 

例:

ALTER TABLE users ALTER COLUMN name TYPE VARCHAR COLLATE "ja-x-icu";

○ ちなみに、 テーブル情報を変えたくない人はSQL文でも、 日本語ソートできます

select * from users order by name COLLATE "ja-x-icu";
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?