Joerg Bruehe wrote:
>> Similarly, I have always been really annoyed that MySQL has no collation that
>> make trailing spaces significant in VARCHAR. The fact that ("X" = "X ") in
>> eg. utf8_bin is just a glaring bug in my opinion. Let the user decide whether
>> they want space to have special significance, not the Database.
>>
>
> This is a tricky issue from the semantics point of view.
>
> I don't have the reference handy, so I can't quote verbatim, but I do
> remember that the X/Open standard for SQL specifies something like
> "All character strings are comparable.
> If character strings are of different length, then the shorter one is
> conceptually padded with blanks at the end before comparison."
>
> This exactly means that "X" == "X ", for any "X".
>
> Granted, X/Open does not mention different collations, so you could have
> a collation that provides a different semantics, but that would make
> matters even more complex.
>
>
The SQL standard has a syntax for specifying NO PAD when creating a
collation, meaning that the string is not implicitly padded with spaces.
The default is PAD SPACE. I am not sure if any databases implement this
attribute, however.
Thanks,
Roy