Re: [ib-support] Re: Database corruption after alter table
Author
Carsten Schäfer
Post date
2003-03-06T13:20:45Z
----- Original Message -----
From: "Thomas Steinmaurer" <ts@...>
To: <ib-support@yahoogroups.com>
Sent: Thursday, March 06, 2003 2:13 PM
Subject: RE: [ib-support] Re: Database corruption after alter table
> Hi Carsten,
>
>
> Any chance that there is a trigger or updateable foreign key
> constraint, which gets fired when the table is updated again,
> so that T_ERGEBNIS is in a restoreable state then?
>
> What is the full DDL of T_ERGEBNIS, T_EINFACHANGEBOT including
> triggers?
>
Both tables have a reference to t_mitarbeiter.
(but all of my tables have a reference to it)
ALTER TABLE T_ERGEBNIS ADD PRIMARY KEY (ID_ERGEBNIS);
ALTER TABLE T_ERGEBNIS ADD CONSTRAINT ERGMIT FOREIGN KEY (F_ID_MA_ACT) REFERENCES T_MITARBEITER (ID_MITARBEITER) ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE T_ERGEBNIS ADD CONSTRAINT ERGWARM FOREIGN KEY (F_ID_WARM) REFERENCES T_WARMBEHANDLUNG (ID_WARMBEHANDLUNG) ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE T_ERGEBNIS ADD CONSTRAINT ERGWERK FOREIGN KEY (F_ID_WERKSTOFF) REFERENCES T_WERKSTOFF (ID_WERKSTOFF) ON DELETE CASCADE ON UPDATE NO ACTION;
CREATE INDEX IND_ERGEBNIS_TIEFE_BIS ON T_ERGEBNIS (F_TIEFE_BIS);
CREATE INDEX IND_ERGEBNIS_TIEFE_VON ON T_ERGEBNIS (F_TIEFE_VON);
SET TERM ^ ;
CREATE TRIGGER TR_ERGEBNIS FOR T_ERGEBNIS
ACTIVE BEFORE INSERT POSITION 0
AS
BEGIN
NEW.id_ergebnis = GEN_ID(gen_ergebnis, 1);
END
^
ALTER TABLE T_EINFACHANGEBOT ADD PRIMARY KEY (F_ID_ANGEBOT);
ALTER TABLE T_EINFACHANGEBOT ADD CONSTRAINT EA_MA_BELEG FOREIGN KEY (F_ID_MA_BELEG) REFERENCES T_MITARBEITER (ID_MITARBEITER) ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE T_EINFACHANGEBOT ADD CONSTRAINT EINFACHANG2ANG FOREIGN KEY (F_ID_ANGEBOT) REFERENCES T_ANGEBOT (ID_ANGEBOT) ON DELETE CASCADE ON UPDATE NO ACTION;