Set byte-wise string comparing in postgresql

Viewed 81

My PostgreSQL string comparison is strange. It looks like dots, commas and other non-alphabet symbols are ignored. How to change this behavior to byte-wise?

strange string compartion

pg version 12.3-1

OS Ubuntu 19-10

1 Answers

The problem was in the OS locale settings, the thing is that LC_COLLATE was set in "en_US.utf8", that was the reason of such strange comparison.

Resolving:

create database with needed LC_COLLATE:

CREATE DATABASE dname WITH
OWNER oname
LC_COLLATE = 'C'
LC_CTYPE = 'en_US.utf8'
TEMPLATE = template0;

the last row needed because the default db template uses system locale

Related