Subject I can't drop foreign key
Author
Hi.

I am using FireBird 2.5.3
and a Database is updated from 2.2, and the database was updated from 1.5.

The database have about 150 tables and just one foreign key.

The Foreign key is from "hachu"Table to "parts"Table

This is part of definition of the tables.
ISQL display these informations.

SQL> show table parts;
OPERATIONCODE                   VARCHAR(100) Nullable
PARTSID                         INTEGER Not Null
PRODUCTCODE                     VARCHAR(100) Nullable
CONSTRAINT INTEG_152:
Primary key (PARTSID)

SQL> show table hachu;
HACHUDATE                       DATE Nullable
HACHUID                         INTEGER Not Null
HACHUNO                         VARCHAR(10) Nullable
HSU                             INTEGER Nullable
CONSTRAINT FKHACHUTOPARTS:
  Foreign key (PARTSID)    References PARTS (PARTSID) On Delete Set Null


I tried to drop the foreign key,but I could not.
SQL> alter table hachu drop constraint fkhachutoparts;

Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-cannot delete
-INDEX FKHACHUTOPARTS
-there are 1 dependencies

I deleted all records of "parts" and "hachu".
I deleted all triggers of "parts" and "hachu".

But "there are 1 dependencies"

I can't also drop these tables.

SQL> drop table hachu;
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-cannot delete
-INDEX FKHACHUTOPARTS
-there are 1 dependencies

SQL> drop table parts;
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-ERASE RDB$RELATION_CONSTRAINTS failed
-action cancelled by trigger (1) to preserve data integrity
-Cannot delete PRIMARY KEY being used in FOREIGN KEY definition.

I don't understand why i can't drop the foreign key.
But i want to drop the foreign key.

Any help appreceiated.

Nobuo Watanabe