PDA

View Full Version : MySQL - errno: 150


fifth
11-12-2006, 16:27
CIao a tutti. Sto provando a creare delle tabelle collegate tra loro, ma quando provoi a definire la tabella che si deve collegare alla prima mi da l'errore:

ERROR 1005 (HY000): Can't create table 'table.frm' (errno: 150)

Come mai???

0rph3n
11-12-2006, 18:19
tratto da:
http://sql-info.de/mysql/referential-integrity.html

3.3. ERROR 1005

[...]

This means either:

* The referenced table is not an InnoDB table
* The referenced column in other_table is not unique
* The referenced column in other_table has a different type to other_id

In MySQL prior to 5.0, this error can also indicate that:

* No index has been defined on the column other_id

buono studio!
'iao

fifth
11-12-2006, 20:19
Ho guardato il link, ma purtroppo non ne esco... La colonna che cerco di riferire è unica, è dello stesso tipo e anche ad usare type=InnoDB non cambia niente.
Le mie due tabelle sono fatte in questo modo:

mysql> create table prova(id int,campouno int,campodue int,text text,primary key(id,campouno,campodue));
Query OK, 0 rows affected (0.13 sec)

mysql> create table prova_coll(id int,campouno int,campodue int,campotre int,primary key(id,campouno,campodue),foreign key(campodue)references p
rova(campodue));
ERROR 1005 (HY000): Can't create table '.\euro\prova_coll.frm' (errno: 150)

Dove sbaglio?

Grazie :)

sergente89
30-01-2013, 10:28
:oink: :oink: :oink: :oink: yeeess!!!