Re: Case sensitivity

From: "John D(dot) Burger" <john(at)mitre(dot)org>
To: "Frank Millman" <frank(at)chagford(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Case sensitivity
Date: 2005-08-10 13:53:23
Message-ID: 9edcc3260f4ffac66b6f02acfe17bf8a@mitre.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Nelson 2005-08-10 14:08:20 ODBC issue with aggregate fields (SUM)
Previous Message Alvaro Herrera 2005-08-10 13:50:32 Re: pgsql and php with ssl mode.