Mirnamiq Abdullayev
Mirnamiq Abdullayev

Reputation: 171

lower function in postgres

How to use lower function in postgres to convert upper special chars to lower special chars. For exam: SELECT lower('Ş'). Its result is 'Ş' not 'ş'.

Upvotes: 1

Views: 209

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 247445

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.

Upvotes: 2

Related Questions