This may be too late for the original poster, but for completeness, the way to achieve case insensitive behaviour from PostgreSQL is to set a non-deterministic collation. This is only for Postgres 12.
A collation is either deterministic or nondeterministic. A
deterministic collation uses deterministic comparisons, which means
that it considers strings to be equal only if they consist of the same
byte sequence. Nondeterministic comparison may determine strings to be
equal even if they consist of different bytes. Typical situations
include case-insensitive comparison, accent-insensitive comparison, as
well as comparison of strings in different Unicode normal forms. It is
up to the collation provider to actually implement such insensitive
comparisons; the deterministic flag only determines whether ties are
to be broken using bytewise comparison. See also Unicode Technical
Standard 10 for more information on the terminology.
To create a nondeterministic collation, specify the property
deterministic = false to CREATE COLLATION, for example:
CREATE COLLATION ndcoll (provider = icu, locale = 'und', deterministic = false);
This example would use the standard Unicode collation in a
nondeterministic way. In particular, this would allow strings in
different normal forms to be compared correctly. More interesting
examples make use of the ICU customization facilities explained above.
For example:
CREATE COLLATION case_insensitive (provider = icu, locale = 'und-u-ks-level2', deterministic = false);
CREATE COLLATION ignore_accents (provider = icu, locale = 'und-u-ks-level1-kc-true', deterministic = false);
All standard and predefined collations are deterministic, all
user-defined collations are deterministic by default. While
nondeterministic collations give a more “correct” behavior, especially
when considering the full power of Unicode and its many special cases,
they also have some drawbacks. Foremost, their use leads to a
performance penalty. Also, certain operations are not possible with
nondeterministic collations, such as pattern matching operations.
Therefore, they should be used only in cases where they are
specifically wanted.
Best Answer
You can append a new collation to your select query to find case sensitive or insensitive.
Just be aware of the performance problems this could present. You will need to scan the clustered index to adjust / find the values when you perform the collation. The way you are writing the
LIKE
piece also makes the query non-sargable.I picked up the collation trick from Kendra Little's SELECT Seminar classes. You can find additional collation information though from Ben Snaidero from MS SQL Tips.
MSDN on Collate.