Ошибка при определении FK
Ошибка при определении FK
Недавно начал использовать IB и тут же наткнулся на грабли:
при выполнении таких запросов :
create table Persons (
Pers_ID smallint not null primary key,
);
create table Institutions (
Inst_ID smallint not null primary key,
);
create table SpecList (
SL_ID smallint not null primary key,
foreign key (Spec_ID) references Specialities (Spec_ID)
on update cascade on delete cascade,
foreign key (Inst_ID) references Institutions(Inst_ID)
on update cascade on delete cascade
);
выскакивает ошибка
Unsuccessful metadata update
Unknown columns in index RDB$FOREIGN17
она выдается как в 5 так и в 6 версии
Возможно, я что-то делаю не так?
при выполнении таких запросов :
create table Persons (
Pers_ID smallint not null primary key,
);
create table Institutions (
Inst_ID smallint not null primary key,
);
create table SpecList (
SL_ID smallint not null primary key,
foreign key (Spec_ID) references Specialities (Spec_ID)
on update cascade on delete cascade,
foreign key (Inst_ID) references Institutions(Inst_ID)
on update cascade on delete cascade
);
выскакивает ошибка
Unsuccessful metadata update
Unknown columns in index RDB$FOREIGN17
она выдается как в 5 так и в 6 версии
Возможно, я что-то делаю не так?
Ошибка при определении FK
Изменил запросы, не помогло. Выдается та же ошибка - Unsuccessful metadata update
Unknown columns in index RDB$FOREIGN45
Вроде создание FK стандартная операция, почему она не работает?
Запросы теперь такие (ошибка выскакивает на последний):
create table Specialities (
Spec_ID smallint not null,
...
constraint SpecId primary key (Spec_ID)
);
create table Institutions (
Inst_ID smallint not null,
...
constraint InstId primary key (Inst_ID)
);
create table SpecList (
SL_ID smallint not null,
constraint SLID primary key (SL_ID)
);
alter table SpecList
add constraint SL_SpecID foreign key (Spec_ID)
references Specialities (Spec_ID)
on update cascade on delete cascade,
add constraint SL_InstID foreign key (Inst_ID)
references Institutions(Inst_ID)
on update cascade on delete cascade;
Unknown columns in index RDB$FOREIGN45
Вроде создание FK стандартная операция, почему она не работает?
Запросы теперь такие (ошибка выскакивает на последний):
create table Specialities (
Spec_ID smallint not null,
...
constraint SpecId primary key (Spec_ID)
);
create table Institutions (
Inst_ID smallint not null,
...
constraint InstId primary key (Inst_ID)
);
create table SpecList (
SL_ID smallint not null,
constraint SLID primary key (SL_ID)
);
alter table SpecList
add constraint SL_SpecID foreign key (Spec_ID)
references Specialities (Spec_ID)
on update cascade on delete cascade,
add constraint SL_InstID foreign key (Inst_ID)
references Institutions(Inst_ID)
on update cascade on delete cascade;