Subject The dreaded foreign key creation error
Author Martijn Tonies
Hi all,

Perhaps we all know the error:

My metadata was this:

Table "RELATIE"

RelatieID PK
... more columns ...

Table "LEVERANCIER"

RelatieID PK, FK to RELATIE
... more columns ...

Table "ORDERREGEL"

LeverancierID FK to LEVERANCIER

Creating this constraint gave me the error that some index wasn't defined in
the tables and a trigger raised an exception bla bla...

A common cause for this error is have an index defined on a primary key
column. In this case, the index was created by the system - namely because
of the FK from LEVERANCIER to RELATIE.

Dropping this FK results in removing the index and the second FK (from
ORDERREGEL to LEVERANCIER) could be created without problems. Next up:
creating the FK from LEVERANCIER to RELATIE. All went well...

It is a workaround for a strange problem -- comments, anyone?

(IB 6.0, NT4)

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com


[Non-text portions of this message have been removed]