Subject Re: [firebird-support] Is this a bug? (FB 2.1 <...> 2.1.2)
Author Ann W. Harrison
Kjell Rilbe wrote:
> Leyne, Sean wrote:
>> The results are correct because the SQL Standard defines trailing spaces
>> as not significant for comparison purposes, regardless of the comparison
>> type (Like or =) or whether the column is defined as a CHAR/VARCHAR.
>
> I thought like did consider trailing spaces to be significant. Is this
> incorrect?

I believe that LIKE is sensitive to trailing spaces, and so it handles
CHAR and VARCHAR differently if you store a string that's shorted than
the declared length. The value of a CHAR(5) with ' A' stored in it is
" A " which equal to a VARCHAR(5) with 'A' stored in it. But for a
LIKE predicate, they're not equivalent.

At least that's the way it worked a few years ago.


Best regards,

Ann