pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John D. Burger <john@mitre.org>
To: Frank Millman <frank@chagford.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Case sensitivity
Date: Wed, 10 Aug 2005 09:53:23 -0400
Message-ID: <9edcc3260f4ffac66b6f02acfe17bf8a@mitre.org> (raw)
In-Reply-To: <VPOP32.1.0e.20050810131929.234.b.1.a40c1f81@chagford.com>
References: <VPOP32.1.0e.20050810131929.234.b.1.a40c1f81@chagford.com>

> 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





view thread (80+ messages)  latest in thread

Message-ID: <9edcc3260f4ffac66b6f02acfe17bf8a@mitre.org>
Permalink:  ../9edcc3260f4ffac66b6f02acfe17bf8a@mitre.org/
Also on:    postgresql.org/message-id/9edcc3260f4ffac66b6f02acfe17bf8a@mitre.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: john@mitre.org, frank@chagford.com
  Subject: Re: Case sensitivity
  In-Reply-To: <9edcc3260f4ffac66b6f02acfe17bf8a@mitre.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox