On Jun 08, 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?
[apparently, nobody answered this while I was on vacations, so here it is]
This was introduced to avoid a limitation in column-level grants. MySQL
wasn't able to distinguish a grant on column "a " from a grant on column
I'm not sure the bug will reappear if you remove the limitation, but I
suppose it will.
Regards / Mit vielen Grüßen,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring