db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Federico Fissore <federico.fiss...@concept.it>
Subject Reserved names in column names
Date Wed, 14 Mar 2007 09:27:51 GMT
Hope this is not as trivial

When generating my sql script out of the schema for the mysql database I
get something like

CREATE TABLE question_option
(
    id_question_option MEDIUMINT NOT NULL AUTO_INCREMENT,
    id_question MEDIUMINT NOT NULL,
    option VARCHAR(255) NOT NULL,
    PRIMARY KEY(id_question_option),
    FOREIGN KEY (id_question) REFERENCES question (id_question)
    ) ENGINE InnoDB;


A part the InnoDB clause that I've added to table.vm file, the problem
here is the "option" column. "option" seems to be a reserved keyword in
mysql so running the script fails. I'm having such an issue because
we've developed against postgresql, which works fine, and I currently
need to install my app onto an existing mysql

The solution is really simple, prepending and appending two "`" so that
it comes something like

CREATE TABLE question_option
(
    id_question_option MEDIUMINT NOT NULL AUTO_INCREMENT,
    id_question MEDIUMINT NOT NULL,
    `option` VARCHAR(255) NOT NULL,
    PRIMARY KEY(id_question_option),
    FOREIGN KEY (id_question) REFERENCES question (id_question)
    ) ENGINE InnoDB;


Is there an option to enable such "`" for column names or something like
that?

Thank you in advance

Federico

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message