Problem with lower() function - Mailing list pgsql-hackers

From Yuva Chandolu
Subject Problem with lower() function
Date
Msg-id A0F24737FCB34F489EC955D143BDD8510173E12D@exchange-sf1.corp.ebates.com
Whole thread Raw
List pgsql-hackers
Hi, We have a problem with lower() function working differently for two
different data types

table: yuva_test
column_name    data_type
yt_name1    varchar(255)
yt_name2    char(1)

The data is
yt_name1    yt_name2
yuva        F
bharat        F
1234556    F
234        F

etc.

When we run the query "select * from yuva_test
lower(yt_name1)=lower('1234556') and lower(yt_name2)=lower('F')" it takes
forever to return, but if try "select * from yuva_test yt_name1='1234556'
and lower(yt_name2)=lower('F')" it returns immediately.

What is happenning here? Why lower behaving differently for varchar(255) and
char(1), and how to make first query to work without changing schema.

Thanks
Yuva


pgsql-hackers by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Wanted: RelationIsVisible interface
Next
From: "Greg Sabino Mullane"
Date:
Subject: Re: Proposal for psql wildcarding behavior w/schemas