Olivier,

please check that the data types of corresponding columns in the referenced
tables are the same, and that you have created the necessary indexes in also
the referenced tables.

I tested the following:

C:\m\client_debug>mysql test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 3.23.46-max-debug-log

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

mysql> CREATE TABLE evaluation(id_evaluation INTEGER NOT NULL, primary key
(id_e
valuation)) type = innodb;
Query OK, 0 rows affected (1.12 sec)

mysql>
mysql> CREATE TABLE question(id_question INTEGER NOT NULL, primary key
(id_quest
ion)) type = innodb;
Query OK, 0 rows affected (0.10 sec)

mysql>
mysql> CREATE TABLE answer(
    ->     id_answer INTEGER NOT NULL,
    ->     text_answer VARCHAR (255),
    ->     id_evaluation INTEGER NOT NULL,
    ->     id_question INTEGER NOT NULL,
    ->     scale_answer INTEGER,
    ->     PRIMARY KEY(id_answer),
    ->     INDEX evaluation_ind (id_evaluation),
    ->     INDEX question_ind (id_question),
    ->     FOREIGN KEY (id_evaluation) REFERENCES evaluation
(id_evaluation),
    ->     FOREIGN KEY (id_question) REFERENCES question (id_question))
type=Inn
oDB;
Query OK, 0 rows affected (0.88 sec)

mysql>

Best regards,

Heikki Tuuri
Innobase Oy
---
Order technical MySQL/InnoDB support at https://order.mysql.com/
See http://www.innodb.com for the online manual and latest news on InnoDB

..................
hi,

I've downloaded mysql-max-nt v.3.23.49, have setup InnoDB startup support. I
am now in the process of creating tables. When these are standard tables no
problem, eg:
create table test (id integer not null, primary key(id)) type=InnoDB;
works fine !
I have problems when I have tables with foreign keys. Here is my sql script:

CREATE TABLE answer(
    id_answer INTEGER NOT NULL,
    text_answer VARCHAR (255),
    id_evaluation INTEGER NOT NULL,
    id_question INTEGER NOT NULL,
    scale_answer INTEGER,
    PRIMARY KEY(id_answer),
    INDEX evaluation_ind (id_evaluation),
    INDEX question_ind (id_question),
    FOREIGN KEY (id_evaluation) REFERENCES evaluation (id_evaluation),
    FOREIGN KEY (id_question) REFERENCES question (id_question))
type=InnoDB;

There I end up with an error 1005 errno 150 I've seen in the doc that my
foreign key syntax might be wrong, but what is wrong ?? Note the same script
works fine without "type=InnoDB".

Any idea ??

Olivier



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to