List:Internals« Previous MessageNext Message »
From:Roy Lyseng Date:June 11 2009 11:02am
Subject:Re: trailing space in column name
View as plain text  
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
Thread
trailing space in column nameZhixuan Zhu9 Jun
  • Re: trailing space in column nameIngo Strüwing9 Jun
    • RE: trailing space in column nameZhixuan Zhu9 Jun
      • RE: trailing space in column nameRick James9 Jun
        • RE: trailing space in column nameZhixuan Zhu9 Jun
          • RE: trailing space in column nameRick James9 Jun
            • RE: trailing space in column nameZhixuan Zhu9 Jun
  • Re: trailing space in column namePaul DuBois10 Jun
    • Re: trailing space in column nameKristian Nielsen11 Jun
      • Re: trailing space in column nameJoerg Bruehe11 Jun
        • Re: trailing space in column nameKristian Nielsen11 Jun
        • Re: trailing space in column nameRoy Lyseng11 Jun
  • Re: trailing space in column nameSergei Golubchik20 Jun