How to use lower function in postgres to convert upper special chars to lower special chars. For exam: SELECT lower('Ş'). Its result is 'Ş' not 'ş'.
-
You need to see the encoding that you're using.William Prigol Lopes– William Prigol Lopes2019-11-28 20:36:05 +00:00Commented Nov 28, 2019 at 20:36
-
utf8mb4. you ask this?Mirnamiq Abdullayev– Mirnamiq Abdullayev2019-11-28 20:36:44 +00:00Commented Nov 28, 2019 at 20:36
-
Don't you need a collation that defines the upper/lower mapping for such characters?jarlh– jarlh2019-11-28 20:50:04 +00:00Commented Nov 28, 2019 at 20:50
Add a comment
|
1 Answer
You have to choose the correct collation:
SELECT lower('Ş' COLLATE "C");
lower
-------
Ş
(1 row)
SELECT lower('Ş' COLLATE "az_AZ.utf8");
lower
-------
ş
(1 row)
If you do not choose a collation explicitly, it is taken from the collation of the column or (lacking that) the collation of the database which you can display with \l.
It is usually a good idea to choose the database collation wisely so that you don't have to specify a collation explicitly.