Re: Case sensitivity - Mailing list pgsql-general

From John D. Burger
Subject Re: Case sensitivity
Date
Msg-id 9edcc3260f4ffac66b6f02acfe17bf8a@mitre.org
Whole thread Raw
In response to Re: Case sensitivity  ("Frank Millman" <frank@chagford.com>)
List pgsql-general
> To handle searching for a row based on a string, I will use
> "LOWER(colname)
> = 'x'" and "LOWER(colname) LIKE 'x%'". AFAICT, the second one is
> equivalent
> to "colname ILIKE 'x%'", provided I force 'x' to lowercase first.

I would strongly suggest you do this instead:

   LOWER(colname) = LOWER('x')

This is far more bullet-proof than lower-casing in the client, in case
the client and the server differ (mismatched locales, etc.).  If you
don't want to use ILIKE for portability reasons (perfectly reasonable),
I suggest the analogous:

   LOWER(colname) LIKE LOWER('x%')

- John D. Burger
   MITRE



pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pgsql and php with ssl mode.
Next
From: Tim Nelson
Date:
Subject: ODBC issue with aggregate fields (SUM)