X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CF130D1B539 for ; Fri, 15 Aug 2003 00:00:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 32811-03 for ; Thu, 14 Aug 2003 21:00:20 -0300 (ADT) Received: from megazone.bigpanda.com (45.mufb.snfc.sffca01r18.dsl.att.net [12.103.249.45]) by svr1.postgresql.org (Postfix) with ESMTP id 717F4D1B524 for ; Thu, 14 Aug 2003 21:00:16 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 73AAED695; Thu, 14 Aug 2003 17:00:19 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 694775C0C; Thu, 14 Aug 2003 17:00:19 -0700 (PDT) Date: Thu, 14 Aug 2003 17:00:19 -0700 (PDT) From: Stephan Szabo To: "Gregory S. Williamson" Cc: Subject: Re: lower/upper functions and strings in searches In-Reply-To: <71E37EF6B7DCC1499CEA0316A256832801057071@loki.globexplorer.com> Message-ID: <20030814165738.M98150-100000@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/181 X-Sequence-Number: 14797 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).