Re: [ib-support] Re: Database corruption after alter table
Author
Carsten Schäfer
Post date
2003-03-06T13:43:50Z
----- Original Message -----
From: "Thomas Steinmaurer" <ts@...>
To: <ib-support@yahoogroups.com>
Sent: Thursday, March 06, 2003 2:39 PM
Subject: RE: [ib-support] Re: Database corruption after alter table
> Hi Carsten,
>
> [snip]
>
> > CREATE TABLE T_EINFACHANGEBOT (
> > F_ID_ANGEBOT INTEGER NOT NULL,
> > F_BETREFF VARCHAR(100),
> > F_ANREDE VARCHAR(100),
> > F_BLOCK1 VARCHAR(3000),
> > F_BLOCK2 VARCHAR(4700),
> > F_BLOCK3 VARCHAR(4700),
> > F_ID_MA_BELEG INTEGER NOT NULL
> > );
> >
> > 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;
>
> When you alter the table T_EINFACHANGEBOT to add a column F_ID_MA_BELEG
> with NOT NULL, then the value 0 (added by the engine automatically)
> doesn't make sense to me according to the followed FOREIGN KEY constraint
> EA_MA_BELEG, as long there isn't an entry in T_MITARBEITER with
> ID_MITARBBEITER=0 ...
>
> Hmm, honestly, I'm a bit confused now ... ;-)
>
>
1) There is a mitarbeiter with id = 0;
2) The constraint ea_ma_beleg was inserted direct after inserting the column f_id_ma_beleg.
(see my first post.)