Re: lower/upper functions and strings in searches

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: "Gregory S(dot) Williamson" <gsw(at)globexplorer(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: lower/upper functions and strings in searches
Date: 2003-08-15 00:00:19
Message-ID: 20030814165738.M98150-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 14 Aug 2003, Gregory S. Williamson wrote:

> I am obviuously doing some newbie trick, and I ordinarily would spend time browing the archives, but the archives.postgresql.org site seems to be absurdly slow.
>
> This is 7.3.3 on a linux box.
>
> I have a bunch of data with state, city, county and country names. When our application does a search for an exact match:
>
> select * from gx_geotowns where l_state = 'NM';
> I get back a lot of rows of cities in New Mexico, as expected.
>
> If I try:
>
> select * from gx_geotowns where upper(l_state) = upper('nm');

You say the column is of type CHAR(), but CHAR(2) or something else?

For 7.3 and earlier, you're going to get a text comparison which means
that trailing spaces are significant (it's effectively no pad in text vs
pad space in char).

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-08-15 00:17:31 Re: lower/upper functions and strings in searches
Previous Message Gregory S. Williamson 2003-08-14 23:46:08 lower/upper functions and strings in searches