Re: [HACKERS] lower() broken? - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [HACKERS] lower() broken?
Date
Msg-id 36CE5361.5BDF621E@alumni.caltech.edu
Whole thread Raw
In response to Re: [HACKERS] lower() broken?  (Vince Vielhaber <vev@michvhf.com>)
List pgsql-hackers
> > Vince> Oops!  Yeah, I guess lower wouldn't work so well if it was
> > Vince> a numeric field.  Anyway, username is a char(8).
> > It won't be equal to 'joblo', it will be equal to 'joblo   '.  You 
> > may want to consider using varchar(8).
> Damn.  That's the one thing that never even occurred to me!

I don't remember what my old Ingres system did for comparisons of char
against other string types; does every system (or the SQL standard)
consider the trailing blanks significant, or should they be implicitly
ignored in comparisons?

btw, if you don't want to redefine the column, then try
 where trim(trailing from username) = lower('joblo');

but that will be a slower query since "username" must be trimmed before
comparison.
                         - Tom


pgsql-hackers by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: [HACKERS] lower() broken?
Next
From: Hannu Krosing
Date:
Subject: Re: [HACKERS] Re: [SQL] SQL-Query 2 get primary key