Skip to content

Commit e666748

Browse files
committed
Handle case-insensitive comparison of diacritics
NodeJS and Postgres differ in how they treat characters like diacritics when lowercasing so we should always lowercase both sides of our equality check in the same language. An example to illustrate the differences: ``` +-------------+------------------------------+----------------+ | Environment | Operation | Result | +-------------+------------------------------+----------------+ | Postgres | lower('BOGOTÁ, D.C.') | 'bogotÁ, d.c.' | | NodeJS | 'BOGOTÁ, D.C.'.toLowerCase() | 'bogotá, d.c.' | +-------------+------------------------------+----------------+ ```
1 parent e9afa9b commit e666748

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/features.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function getByName(query, callback) {
159159
const names = query.name.constructor === Array ? query.name : [query.name];
160160

161161
let namesDisjunction = `(${names.map(function(name) {
162-
return `lower(name) = ${escapeSql(name.toLowerCase())}`;
162+
return `lower(name) = lower(${escapeSql(name)})`;
163163
}).join(" OR ")})`;
164164
let nameQuery = `SELECT ${buildQueryColumns(query)} FROM features WHERE ${namesDisjunction}`;
165165

0 commit comments

Comments
 (0)