Subject RE: [ib-support] Re: Database corruption after alter table
Author Thomas Steinmaurer
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 ... ;-)


Regards,
Thomas.