1

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

3
  • You need to see the encoding that you're using. Commented Nov 28, 2019 at 20:36
  • utf8mb4. you ask this? Commented Nov 28, 2019 at 20:36
  • Don't you need a collation that defines the upper/lower mapping for such characters? Commented Nov 28, 2019 at 20:50

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.