Vince Vielhaber ha scritto:
> I have a record in table cust with the username of joblo and it's
> already lower case. This is from a cvsup a couple of weeks old.
>
> classifieds=> select count(*) from cust where username = lower('joblo');
> count
> -----
> 0
> (1 row)
>
> classifieds=> select count(*) from cust where username = 'joblo';
> count
> -----
> 1
> (1 row)
>
> Doesn't seem to matter if I use lower on username, 'joblo' or both. And
> there's only the one record in the table.
>
> Did something break or did I forget how to use lower()?
>
> Vince.
I suppose you defined username as char() like...
prova=> create table test(username char(10));
CREATE
prova=> insert into test values ('joblo');
INSERT 207732 1
prova=> select count(*) from test where username = lower('joblo');
count
----- 0
(1 row)
prova=> select count(*) from test where trim(username) = lower('joblo');
count
----- 1
(1 row)
prova=> select count(*) from test where username = 'joblo';
count
----- 1
(1 row)
prova=> select count(*) from test where username = lower('joblo ');
count
----- 1
(1 row)
The lower function "trims" the trailling spaces, this is why comparison fails.
because 'joblo ' != 'joblo'
I think this is a bug.
- Jose' -