PostgreSQL Windows Turkish Search Problem

Started by Halil İbrahim AYHAN7 months ago2 messagesbugs
Jump to latest
#1Halil İbrahim AYHAN
ibrahimayhan@hotmail.com.tr

I am using PostgreSQL Windows version as Turkish Collation
The table contains the record "ŞİLİ" and "şili",
When I Search with ILike, It Does Not Perform Case-Insensitive Searches,
When I search with uppercase letters, I get 1 result, and when I search with lowercase letters, I get 1 result.
There is no problem with Turkish Collection in Linux Version and 2 results are given.
This problem occurs in Windows version.

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Halil İbrahim AYHAN (#1)
Re: PostgreSQL Windows Turkish Search Problem

On Thu, 2025-09-11 at 07:42 +0000, Halil İbrahim AYHAN wrote:

I am using PostgreSQL Windows version as Turkish Collation
The table contains the record "ŞİLİ" and "şili",
When I Search with ILike, It Does Not Perform Case-Insensitive Searches,
When I search with uppercase letters, I get 1 result, and when I search with lowercase letters, I get 1 result.
There is no problem with Turkish Collection in Linux Version and 2 results are given.
This problem occurs in Windows version.

There is a lack of SQL statements in your report, but I assume
this is either a user error or a shortcoming of the Windows
C library, both of which are not under our control.

Try like this:

CREATE COLLATION turkish_ci (
PROVIDER = icu,
DETERMINISTIC = FALSE,
LOCALE = 'tr-TR@colStrength=level2'
);

CREATE TABLE tr (st text COLLATE turkish_ci);

INSERT INTO tr VALUES ('ŞİLİ'), ('şili');

SELECT * FROM tr WHERE st = 'şili';

st
══════
ŞİLİ
şili
(2 rows)

You could also define the column with a different collation and
add the COLLATE clause in the query.

Yours,
Laurenz Albe