"Jeff" <EMAIL REMOVED> wrote in news:1uidnR8xTp-
EMAIL REMOVED:
> When trying to create the Property table (see below) I get this error
> message: ERROR 1005 (HY000): Can't create table '.\demo\property.frm'
> (errno: 150)
>
> create table User (
> UserId int unsigned not null auto_increment primary key,
> UserForname varchar(50) not null
> );
>
> create table Property (
> PropertyId int unsigned not null auto_increment primary key,
> PropertyOwner int not null,
> index idxPropertyOwner using hash (PropertyOwner),
> foreign key (PropertyOwner) references User(UserId) on delete cascade
> );
Because of the foreign key constraint, the datatypes of User.UserId and
Property.PropertyOwner should be *exactly* the same.
Why are you using a hash-index? As far as I can tell, it's only supported
for MEMORY tables. And MEMORY tables cannot enforce referential
integrity.
--
felix