Bug #14336 table alias "release" leads to syntax error
Submitted: 26 Oct 2005 17:14 Modified: 26 Oct 2005 19:08
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.13rc OS:Linux (debian/sid)
Assigned to: MySQL Verification Team CPU Architecture:Any

[26 Oct 2005 17:14] [ name withheld ]
Description:
In former versions of mysql you could use an table alias named "release". In mysql 5.0.13rc (installed from debian/sid repository) this leads to an syntax error. See example below.

How to repeat:
create table foo (a integer, b integer);

select release.a from foo release where release.b=1;

ERROR: 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 where release.b=1' at line 1
[26 Oct 2005 19:08] 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://www.mysql.com/documentation/ 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 see:

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

miguel@hegel:~/dbs/5.0> bin/mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.16-debug

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

mysql> create table foo (a integer, b integer);
Query OK, 0 rows affected (0.04 sec)

mysql> insert into foo set a=1,b=1;
Query OK, 1 row affected (0.00 sec)

mysql> select release.a from foo release where release.b=1;
ERROR 1064 (42000): 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 where release.b=1' at line 1
mysql> select `release`.a from foo `release` where `release`.b=1;
+------+
| a    |
+------+
|    1 |
+------+
1 row in set (0.00 sec)
[27 Oct 2005 7:52] [ name withheld ]
Thank you for your answer. Putting the alias into apostrophe is an idea that I did not had before.

But: I have reported this because this is an incompatibility to the former versions of mysql. Certainly this is an reserved word. I guess it has to do with "release transaction...". But I had the hope that the statement parser could be enhanced to recognize that in this context "release" is an table alias. I think that theoretically this should be possible, but certainly do not know how complicated this would be to implement.

So I hope that not too many new reserved words will be introduced in future making conflicts with existing code.

Greetings,

Gert