"1046: You have an error in your SQL syntax" message during installation

"1046: You have an error in your SQL syntax" message during installation

by Fong Mak -
Number of replies: 2

Hi,

I need help with the following message received during installation:

---------------------------

choice

(mysql): CREATE TABLE mdl_choice ( id int(10) unsigned NOT NULL auto_increment, course int(10) unsigned NOT NULL default '0', name varchar(255) NOT NULL default '', text text NOT NULL, format tinyint(2) unsigned NOT NULL default '0', answer1 varchar(255) NOT NULL default 'Yes', answer2 varchar(255) NOT NULL default 'No', answer3 varchar(255) default NULL, answer4 varchar(255) default NULL, answer5 varchar(255) default NULL, answer6 varchar(255) default NULL, publish tinyint(2) unsigned NOT NULL default '0', release tinyint(2) unsigned NOT NULL default '0', allowupdate tinyint(2) unsigned NOT NULL default '0', showunanswered tinyint(2) unsigned NOT NULL default '0', timeopen int(10) unsigned NOT NULL default '0', timeclose int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id), UNIQUE KEY id (id), KEY course (course)) TYPE=MyISAM COMMENT='Available choices are stored here.'  

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 tinyint(2) unsigned NOT NULL default '0', allowupdate tinyint(2) unsign' at line 1

Error

------------------

It appears that the "Choice" table could not be created correctly.  Please advise.

The following are the software/system configuration that I used:

a. Moodle: 1.4.4

b. PHP 5.0.4

c. Appache 2.0.54

d. MySQL 5.0.4-beta

e. Installed on Window 2003 server as well as Window XP.

Both instances stop at the above error message while creating "choice" table.

Your suggestions and assistance is greatly appreciated.

Thanks,

Mak

Average of ratings: -
In reply to Fong Mak

Re: "1046: You have an error in your SQL syntax" message during installation

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

'release' is a reserved word in MySql! This is a bug and has been reported in the bug tracker. Not sure what the workaround is - possibly not to use a MySql 5 version. I would back off to version 4.something if you possible can....

http://moodle.org/bugs/bug.php?op=show&bugid=3062&pos=21

In reply to Howard Miller

Re: "1046: You have an error in your SQL syntax" message during installation

by Fong Mak -

Thank you for your suggestion.  I have managed to modify the code by adding quote around the reserved words "release" to get around the problem. 

Thanks.