Subject object is in use when creating foreign key
Author julien_ferraro
Hello,

I encounter a problem with Firebird. I'm unable to create foreign keys.

I try to create the following table :

CREATE TABLE GuideSaisieLigne
(
Guide DGuideSaisie NOT NULL,
Id SMALLINT NOT NULL,
Journal DJournal,
JournalModifiable BOOLEAN,
Compte VARCHAR(12),
CompteModifiable BOOLEAN,
Libelle VARCHAR(250),
LibelleModifiable BOOLEAN,
TypeSelectionReference SMALLINT,
ReferenceLigne SMALLINT,
ReferenceTypeDoc SMALLINT,
ReferenceModifiable BOOLEAN,
Direction SMALLINT,
MontantFormule VARCHAR(250),
MontantModifiable BOOLEAN,

CONSTRAINT pk_GuideSaisieLigne PRIMARY KEY(Guide, Id),
CONSTRAINT fk_GuideSaisieLigne_Journal FOREIGN KEY(Journal)
REFERENCES Journal(Id)
)

I get the following error message :
unsuccessful metadata update
object JOURNAL is in use

This happens almost everytime I try to create a foreign key. I did a
backup restore just before, and I'm sure there is no other conecion to
the database. I'm using the last stable release of Firebird (1.5.2.4731)
on WinXP Pro, the database is on the same computer as the server.

What is strange is that If I execute my script on an empty database,
everything goes well.

I first thought my database was corrupted. But that happens on all my
production databases (10 or so) so I don't think it's the case.

Any idea ?

TIA

Julien