MySQL Forums :: InnoDB :: ERROR 1005: Can't create table (errno: 150)

Advanced Search

ERROR 1005: Can't create table (errno: 150)
Posted by: Fuuryoku Chan ()
Date: July 23, 2013 07:53AM

Hello, I am trying to create the following table

create table messaInScena
data date,
ora time,
spazio varchar(20),
spettacolo varchar(40),
postiDisponibili smallint,
prezzoIntero decimal(5,2),
prezzoRidotto decimal(5,2),
prezzoStudenti decimal(5,2),
primary key (data, ora, spazio),
foreign key (spazio) references spazio(nome) on update cascade on delete set null,
foreign key (spettacolo) references spettacolo(titolo) on update cascade on delete set null,
constraint RA3_1 check (postiDisponibili >= 0)
) ;

but I get the following error:
Error Code: 1005 Can not create table 'teatrosql.messainscena' (errno: 150)

The tables that are referenced by foreign keys are:

create table spazio
nome varchar(20) primary key,
indirizzo varchar(40) not null,
pianta varchar(20),
capienza smallint

create table spettacolo
titolo varchar(40) primary key,
descrizione LONGBLOB,
annoProduzione char(4)

I have already verified that the fk are unique and that there are no typos (but given a control also you that you never know :D). As you can see the reference fields are primary keys. between fields and fk reference types and dimensions coincide ..

where am I wrong??

ps. if you need to place all the tables

Options: ReplyQuote

Subject Views Written By Posted
ERROR 1005: Can't create table (errno: 150) 3968 Fuuryoku Chan 07/23/2013 07:53AM
Re: ERROR 1005: Can't create table (errno: 150) - Solved 1480 Fuuryoku Chan 07/23/2013 09:05AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.