Bug #10413 Invalid column name is not rejected
Submitted: 6 May 2005 13:18 Modified: 1 Jun 2005 15:49
Reporter: Trudy Pelzer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.11, 5.0.4 Beta OS:Microsoft Windows (Windows 2003)
Assigned to: Antony Curtis CPU Architecture:Any

[6 May 2005 13:18] Trudy Pelzer
Description:
See Bug#10408. The problem as reported by Disha is not
a bug. That is: The expectation -- that the column name 
containing a dot should be accepted -- is not correct.

But it is a bug that the parser accepts the unquoted syntax
and silently ignores the first part of the name. If a qualified
identifier contains an invalid part, the server should reject
the name, rather than silently dropping the invalid portion
and creating the object with an unexpected name.

How to repeat:
mysql> create table tb1(column.name char(100))//
Query OK, 0 rows affected (0.06 sec)
-- This is the incorrect result. A qualified column name
must have this hierarchy:
<database name>.<table name>.<column name>
If any portion of the qualification is invalid, the CREATE
TABLE statement should be rejected.

In this case the only correct qualification is tb1.name,
since column.name implies that a column called name
belongs to a table called column.
   
   mysql> show create table tb1//
   +-------+---------------------------------------
   | Table | Create Table
   +-------+---------------------------------------
   | tb1   | CREATE TABLE `tb1` (
     `name` char(100) default NULL
   ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
   +-------+---------------------------------------
   1 row in set (0.00 sec)
-- The silent removal of the invalid qualification should
not occur.
[23 May 2005 4:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25169
[29 May 2005 1:49] Antony Curtis
Approved by Sergei
[1 Jun 2005 14:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25455
[1 Jun 2005 15:49] Antony Curtis
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

pushed to 4.1.13 repo (and 5.0.7 repo)