Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 15CBD4767F4 for ; Wed, 12 Jun 2002 21:34:13 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 9B59D476568 for ; Wed, 12 Jun 2002 21:34:03 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 5A76AD606; Wed, 12 Jun 2002 18:34:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 502735C01; Wed, 12 Jun 2002 18:34:05 -0700 (PDT) Date: Wed, 12 Jun 2002 18:34:05 -0700 (PDT) From: Stephan Szabo To: isaac flemmin Cc: Subject: Re: Case insensitive select In-Reply-To: <000001c21273$5cc3f3c0$ad463e04@ixic> Message-ID: <20020612183244.D97399-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200206/160 X-Sequence-Number: 8125 On Wed, 12 Jun 2002, isaac flemmin wrote: > Hello, > > I am using PostgreSQL 7.2 and I am trying to do a case insensitive > select statement using the lower function. I am using these lines from > the PostgreSQL 7.2 users guide as a template for my query. > > -- > "For example, a common way to do case-insensitive comparisons is to use > the lower function: > SELECT * FROM test1 WHERE lower(col1) = 'value';" > -- > > The query looks almost exactly the same but it always returns 0 results. > This does not make sense to me because if the query, > > "SELECT * FROM test1 WHERE col1 = 'Value';", > > returns something, then I assume the query, > > "SELECT * FROM test1 WHERE lower(col1) = 'value';", > > should return something as well. Do I not understand the way that the > lower function works, or is there something else I have to do? Obviously If col1 is char(n), the above may have wierd results due to padding spaces I believe. Does trim(lower(col1))='value' give results?