List:Internals« Previous MessageNext Message »
From:Paul DuBois Date:June 10 2009 8:09pm
Subject:Re: trailing space in column name
View as plain text  
On Jun 8, 2009, at 5:08 PM, Zhixuan Zhu wrote:

> This may sound minor, but it creates lots of trouble to us. For some
> reason MySQL disallow column names with trailing space in create  
> table.
> We're doing lots of "create table as select" type of queries and so
> statements like this will fail:
>
> Create table test as select "command ", command_type from  
> command_table;
>
> We plan to relax the trailing space limitation by modifying table.cc  
> (we
> build mysql 5.1.26 from source). Will that cause troubles else where?
> Another option is that we can remove the trailing spaces in  
> sql_table.cc
> before the field name is passed to check_column_name(). But just
> wondering why MySQL wouldn't do the same thing. Is there any pitfalls?


In the documentation, "Database, table, and column names should not  
end with space characters" first appears in the 4.0.21 and 4.1.3  
manuals. I don't know whether there is a bug report associated with  
the change -- I don't see anything in the changelogs -- or what the  
rationale is for the change.  Possibly it has something to do with  
with end spaces being not significant in string comparisons, but  
that's just a wild guess.

-- 
Paul DuBois
Sun Microsystems / MySQL Documentation Team
Madison, Wisconsin, USA
www.mysql.com

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