Bug #39285 Underscores "_" in the column rows causes syntax error while retrieving data
Submitted: 6 Sep 2008 0:18 Modified: 6 Sep 2008 0:56
Reporter: Jaswant Bhardwaj Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.67 OS:Any
Assigned to: CPU Architecture:Any

[6 Sep 2008 0:18] Jaswant Bhardwaj
Description:
I have the following in a row:

release    pri  ord    logins
6.1.3_ISR   d1  12   login1,login2 

mysql <db>

mysql > select release from perms;

mysql> select release from perms;
ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'release from perms' at line 1

How to repeat:
I have the following in a row:

release    pri  ord    logins
6.1.3_ISR   d1  12   login1,login2 

mysql <db>

mysql > select release from perms;

mysql> select release from perms;
ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'release from perms' at line 1
[6 Sep 2008 0:56] MySQL Verification Team
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional Info:

Release is a reserved word. Please read the Manual how to handle
reserved words at:

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

c:\dbs>c:\dbs\5.0\bin\mysql -uroot --port=3500 --prompt="mysql 5.0 > "
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.70-nt-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql 5.0 > use test
Database changed
mysql 5.0 > create table perms (`release` char(10));
Query OK, 0 rows affected (0.13 sec)

mysql 5.0 > insert into perms values ("6.1.3_ISR");
Query OK, 1 row affected (0.02 sec)

mysql 5.0 > select release from perms;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that c
ight syntax to use near 'release from perms' at line 1

mysql 5.0 > select `release` from perms;
+-----------+
| release   |
+-----------+
| 6.1.3_ISR |
+-----------+
1 row in set (0.03 sec)