lower/upper functions and strings in searches

From: "Gregory S(dot) Williamson" <gsw(at)globexplorer(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: lower/upper functions and strings in searches
Date: 2003-08-14 23:46:08
Message-ID: 71E37EF6B7DCC1499CEA0316A256832801057071@loki.globexplorer.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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');

I get back:
---------+-----------+----------+------------+------+------
(0 rows)

I've used other databases in which a similar statement worked as exepected:
select * from clients
where upper(client_name) = upper("Some client or otheR");

And it finds the row(s) in question ...

I just know I'm overlooking some real obvious thing but for some reason this eludes me. I could see if the search was very slow (the function returns type "text" and the indexed columns are of type CHAR().

If someone could offer help I would appreciate it,

Thanks,

Greg Williamson
DBA GlobeXplorer LLC

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2003-08-15 00:00:19 Re: lower/upper functions and strings in searches
Previous Message Jan Wieck 2003-08-14 18:55:38 Re: [SQL] EXTERNAL storage and substring on long strings