Subject Re: [firebird-support] object in use error
Author Thomas Steinmaurer
Hello,

> I'm still using fb 1.5.3 SS version and got an strange error. I want
> to create a foreign key constraint in table CURS_SEGUIMENT as follows:
>
> alter table CURS_SEGUIMENT
> add constraint FK_CURS_SEGUIMENT_CURS
> foreign key (IDCURS)
> references CURS (ID)
> on update NO ACTION
> on delete NO ACTION
>
>
> but when commiting transaction it raises next error (with flamerobin):
>
> Starting transaction...
> Preparing query: alter table CURS_SEGUIMENT
> add constraint FK_CURS_SEGUIMENT_CURS
> foreign key (IDCURS)
> references CURS (ID)
> on update NO ACTION
> on delete NO ACTION
> Prepare time: 00:00:02.
> Plan not available.
>
>
> Executing...
> Done.
> 390 fetches, 14 marks, 0 reads, 0 writes.
> 4 inserts, 1 updates, 0 deletes, 102 index, 0 seq.
> Delta memory: 3472 bytes.
> RDB$INDEX_SEGMENTS: 1 inserts.
> RDB$INDICES: 1 inserts. Commiting transaction...
>
> RDB$RELATIONS: 1 updates.
> RDB$RELATION_CONSTRAINTS: 1 inserts.
> RDB$REF_CONSTRAINTS: 1 inserts.
> Execute time: 00:00:09.
> *** IBPP::SQLException ***
> Context: Transaction::Commit
>
> SQL Message : -607
> This operation is not defined for system tables.
>
> Engine Code : 335544351
> Engine Message :
> unsuccessful metadata update
> object CURS is in use
>
>
> I tried with another database manager and no luck. I have restarted fb
> service and error raise again. The last thing I tried was deleting all
> rows from CURS_SEGUIMENT before creating constraint and no luck again.
> What's wrong?!?!

You need to be the only one connected to the database to create a
foreign key constraint in Firebird 1.x.

This has been relaxed in Firebird 2.x though.


--
Best Regards,
Thomas Steinmaurer
LogManager Series - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database, MS SQL Server and
NexusDB V2
Upscene Productions
http://www.upscene.com