Bug #45835 Range as column name not parsed correctly
Submitted: 29 Jun 2009 18:13 Modified: 29 Jun 2009 21:23
Reporter: Bob Hampton Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DDL Severity:S2 (Serious)
Version:5.1.35 OS:Linux (Fedora 11)
Assigned to: CPU Architecture:Any

[29 Jun 2009 18:13] Bob Hampton
Description:
'range' is no longer accepted as a column name thanks to the new partition feature.  There doesn't seem to be any way to disable this misfeature short of recompiling the source (I haven't tested whether this works).  Since range is an option keyword WITHIN the PARTITION BY clause, it seems that this restriction is somewhat unreasonable.

How to repeat:
   CREATE TABLE  lanalog (
      devid SMALLINT UNSIGNED NOT NULL,      /* ref to ldevice id */
      id SMALLINT UNSIGNED NOT NULL,         /* ref to element id */
      range VARCHAR(32),                     /* analog range */
      conversion VARCHAR(32),                /* conversion info */

      PRIMARY KEY (devid, id)
   );

Suggested fix:
Allow 'range' as a column name.
[29 Jun 2009 21:23] MySQL Verification Team
Thank you for the bug report. Please read about reserved words at:

http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

c:\dbs>c:\dbs\5.1\bin\mysql -uroot --port=3510 --prompt="mysql 5.1 >"
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.37-Win X64-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement

mysql 5.1 >use test
Database changed
mysql 5.1 >CREATE TABLE  lanalog (
    ->       devid SMALLINT UNSIGNED NOT NULL,      /* ref to ldevice id */
    ->       id SMALLINT UNSIGNED NOT NULL,         /* ref to element id */
    ->       `range` VARCHAR(32),                     /* analog range */
    ->       conversion VARCHAR(32),                /* conversion info */
    ->       PRIMARY KEY (devid, id)
    ->    );
Query OK, 0 rows affected (0.19 sec)