RE: [GENERAL] Strange behaviour ? - Mailing list pgsql-general

From Jackson, DeJuan
Subject RE: [GENERAL] Strange behaviour ?
Date
Msg-id F10BB1FAF801D111829B0060971D839F36835A@cpsmail
Whole thread Raw
List pgsql-general
> > look up the differences between varchar and char data types.
>
> I know the difference between varchar and char, but I don't see why
> LOWER() is
> adding spaces. If this is the correct behaviour, could you kindly
> point me to
> the related docs ?
>
The LOWER() function is not adding the spaces; the char() datatype is
adding the spaces.  The "char = text" compare operator ignores the
spaces at the end of the char type.  But when you use the lower function
the type is returned as varchar() including the spaces, and the "varchar
= text" operator doesn't ignore the spaces.  Try either changing the
type to varchar which won't add the spaces to the end, or using
"LOWER(TRIM(char)) = text".

> Thanks.
>
> Bye!
>
> --
>  Daniele
>
> ----------------------------------------------------------------------
> ---------
> "On the Internet, no one knows you're using Windows NT"
> (Submitted by Ramiro Estrugo, restrugo@fateware.com)
> ----------------------------------------------------------------------
> ---------
>  Se telecom italia aggiungesse uno scatto al giorno ad ogni abbonato,
> dal
>  primo Gennaio avrebbe rubato 669.032.000.000 Lire.
> ----------------------------------------------------------------------
> ---------
>  Daniele Orlandi - Utility Line Italia - http://www.orlandi.com
>  Via Mezzera 29/A - 20030 - Seveso (MI) - Italy
> ----------------------------------------------------------------------
> ---------

pgsql-general by date:

Previous
From: Daniele Orlandi
Date:
Subject: Re: [GENERAL] Strange behaviour ?
Next
From: Maarten Boekhold
Date:
Subject: Re: [GENERAL] User authentication blues