pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mintoo Lall <tlqmail@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Using UPPER and TRIM (INDEX usage)
Date: Sun, 25 May 2003 19:48:29 -0700 (PDT)
Message-ID: <20030526024829.32935.qmail@web40204.mail.yahoo.com> (raw)

Hi Everybody,
 
How do I use "TRIM" and "UPPER" both in the SQL statement and still use the index.
 
I created an index on myTable in the following way
 
CREATE INDEX index_fname_myTable ON myTable USING btree (upper(fname));

Now  the SQL I used was
 

SELECT * FROM myTable where upper(trim(fname))= 'JOHN':: character varying
 
The postgresql doesnt use the index on fname in the above case. 
 
But if I use only "UPPER" in the SQL statement, the postgresql uses the index. For eg. SELECT * FROM myTable where upper(fname)= 'JOHN':: character varying
 
Any help is appreciated. 
 
Regards
Mintoo
 
 
 
 


---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.

view thread (2+ messages)  latest in thread

Message-ID: <20030526024829.32935.qmail@web40204.mail.yahoo.com>
Permalink:  ../20030526024829.32935.qmail@web40204.mail.yahoo.com/
Also on:    postgresql.org/message-id/20030526024829.32935.qmail@web40204.mail.yahoo.com

 · 

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-sql@postgresql.org
  Cc: tlqmail@yahoo.com
  Subject: Re: Using UPPER and TRIM (INDEX usage)
  In-Reply-To: <20030526024829.32935.qmail@web40204.mail.yahoo.com>

* 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