----- Original Message -----
From: "Helen Borrie" <helebor@...>
To: <ib-support@yahoogroups.com>
Sent: Sunday, October 07, 2001 4:29 PM
Subject: Re: [ib-support] Can't insert foreign key constraint
> At 03:53 PM 07-10-01 +0200, Carsten Schaefer wrote:
> >Hi,
> >i have a table:
> >create table T_CH_APOS_ZUORD (
> > F_ID_CHARGE INTEGER NOT NULL,
> > F_ID_APOS INTEGER NOT NULL
> >);
> >ALTER TABLE T_CH_APOS_ZUORD
> > ADD PRIMARY KEY
> > (F_ID_CHARGE,F_ID_APOS);
> >
> >Now i want to add a foreign key constraint to it (t_charge has id_charge
as primary key):
> >ALTER TABLE T_CH_APOS_ZUORD
> > ADD CONSTRAINT FK_CH_APOS_ZUORD_ID_CHARGE FOREIGN KEY
> > (f_id_charge)
> > REFERENCES T_CHARGE
> > (ID_CHARGE)
> > ON UPDATE NO ACTION
> > ON DELETE CASCADE;
> >
> >I get the following error from ibconsole:
> >
> >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 T_CH_APOS_ZUORD
> > ADD CONSTRAINT FK_CH_APOS_ZUORD_ID_CHARGE FOREIGN KEY
> > (f_id_charge) <--------------------------------
> > REFERENCES T_CHARGE
> > (ID_CHARGE)
> > ON UPDATE NO ACTION
> > ON DELETE CASCADE
> >
>
> Carsten,
> Has IBConsole by any chance created case-sensitive identifiers in your
database? Does it work to add the constraint using the same case as was
used for creating the table, i.e. F_ID_CHARGE.
>
Helen,
I don't think this is the problem.
(IBConsole shows all Metadata Uppercase)
I tested it with F_ID_CHARGE without another result.
(As i wrote:On another DB with same metadata but with much less data it
works!)
In IB Query from MiTec i get the same error:
Statement #1:
This operation is not defined for system tables.
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.