Bug #14125
closed"HASH" is a reserved SQL keyword
0%
Description
I cannot create tables who contain a field called "HASH" because in MySQL 4.1.0-alpha it is a SQL reserved keyword.
From file tables.sql
CREATE TABLE cache_hash (
hash varchar(32) DEFAULT '' NOT NULL,
content mediumblob NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
ident varchar(20) DEFAULT '' NOT NULL,
PRIMARY KEY (hash)
);
try:
mysql test < error-test.sql
ERROR 1064 at line 1: You have an error in your SQL syntax. Check the manual that correspondes to your MySQL server version for the right syntax to use near 'hash varchar(32) DEFAULT '' NOT NULL,
content mediumblob NOT
(issue imported from #M34)
Updated by Robert Lemke over 20 years ago
Hi Davide,
HASH is not in the list of reserved keywords [1] and I couldn't even find something related to that in the Changelog of MySQL 4.1.0 alpha.
Are you sure that it fails because of the fieldname? Have you tried putting the fieldname into backticks? - that should work at least.
[1] http://dev.mysql.com/doc/mysql/en/Reserved_words.html
edited on: 04-29-04 17:38
Updated by old_davide over 20 years ago
The problem is that in the Changelog there is nothing about HASH but if you look at Docs/reservedwords.txt from the MySQL 4.1.0-alpha (the version I'm working with) source distribution .tgz, HASH is a reserved keyword and in the manual.html at "6.1.7 Is MySQL Picky About Reserved Words?", HASH is in the list too.
Updated by old_root old_root over 20 years ago
HASH is no longer a reserved word as of MySQL 4.1.1.
See changelog: http://dev.mysql.com/doc/mysql/en/News-4.1.1.html
Updated by old_davide over 20 years ago
Thank you Ingmars! You found the answer... going to upgrade my MySQL server to 4.1.1.
This bug can be "RESOLVED" and "CLOSED"
Thank you
Davide