小编Cur*_*Poe的帖子

为什么我的 PostgreSQL ORDER BY 不区分大小写?

我在 Debian 上运行 Postgres 9.4.4,我得到以下ORDER BY行为:

veure_test=# show LC_COLLATE;
 lc_collate  
-------------
 en_US.UTF-8
(1 row)

veure_test=# SELECT regexp_split_to_table('D d a A c b CD Capacitor', ' ') ORDER BY 1;
 regexp_split_to_table 
-----------------------
 a
 A
 b
 c
 Capacitor
 CD
 d
 D
(8 rows)
Run Code Online (Sandbox Code Playgroud)

并且uname -a

Linux ---- 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

但是,在我的 iMac 上,使用 Postgres 9.3.4,我得到以下信息:

veure_test=# show LC_COLLATE;
 lc_collate  
-------------
 en_US.UTF-8
(1 row)

veure_test=# SELECT regexp_split_to_table('D d a A c b CD Capacitor', ' …
Run Code Online (Sandbox Code Playgroud)

postgresql collation

32
推荐指数
1
解决办法
2万
查看次数

标签 统计

collation ×1

postgresql ×1