Subject Re: [ib-support] Implementing referential integrity
Author Martijn Tonies
Hi,

Well, if this is the only meta data changes you did, then I would say
that either CODING_ID is not a primary or unique constraint in the
CODING table. Or (which, btw, is a small bug) you have additional
indices on the CODING.CODING_ID field.

What also (sometimes) helps, is doing this:

ALTER TABLE BOOK ADD FOREIGN KEY (CODING_ID) REFERENCES CODING


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

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."

> Here's the error message:
>
> Unsuccessful metadata update
> STORE RDB$REF_CONSTRAINTS failed
> action cancelled by trigger (1) to preserve data integrity
> Name of Referential Constraint not defined in constraints table
> Statement: ALTER TABLE BOOK ADD FOREIGN KEY (CODING_ID) REFERENCES CODING
> (CODING_ID)
>
>
> > What's the error message? And what is the table metadata for both
> > tables?
> >
> > Martijn Tonies
> >
> > > What is wrong with the following for adding a foreign key to a table?
> > >
> > > ALTER TABLE BOOK ADD CODING_ID INTEGER;
> > > ALTER TABLE BOOK ADD FOREIGN KEY (CODING_ID) REFERENCES CODING
> > (CODING_ID);
> > >
> > > Thanks,
> > > Stephen