From 689f21ca664c64d2f6b6c89587efa2a3b9158c1b Mon Sep 17 00:00:00 2001 From: Saihajpreet Singh Date: Wed, 5 Jan 2022 18:34:03 -0600 Subject: [PATCH] store: make comparisons case-insensitive --- store/postgres/src/relational_queries.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/store/postgres/src/relational_queries.rs b/store/postgres/src/relational_queries.rs index f467d33c0f3..b830d409342 100644 --- a/store/postgres/src/relational_queries.rs +++ b/store/postgres/src/relational_queries.rs @@ -873,9 +873,9 @@ impl<'a> QueryFilter<'a> { Value::String(s) => { out.push_identifier(column.name.as_str())?; if negated { - out.push_sql(" not like "); + out.push_sql(" not ilike "); } else { - out.push_sql(" like ") + out.push_sql(" ilike ") }; if s.starts_with('%') || s.ends_with('%') { out.push_bind_param::(s)?; @@ -1149,14 +1149,16 @@ impl<'a> QueryFragment for QueryFilter<'a> { NotIn(attr, values) => self.in_array(attr, values, true, out)?, StartsWith(attr, value) => { - self.starts_or_ends_with(attr, value, " like ", true, out)? + self.starts_or_ends_with(attr, value, " ilike ", true, out)? } NotStartsWith(attr, value) => { - self.starts_or_ends_with(attr, value, " not like ", true, out)? + self.starts_or_ends_with(attr, value, " not ilike ", true, out)? + } + EndsWith(attr, value) => { + self.starts_or_ends_with(attr, value, " ilike ", false, out)? } - EndsWith(attr, value) => self.starts_or_ends_with(attr, value, " like ", false, out)?, NotEndsWith(attr, value) => { - self.starts_or_ends_with(attr, value, " not like ", false, out)? + self.starts_or_ends_with(attr, value, " not ilike ", false, out)? } } Ok(())