Subject Re: [ib-support] cascading delete
Author Helen Borrie
At 10:47 PM 8/03/2003 +0000, you wrote:
>1. say you have 3 tables:
>
>create table Worlds (
>World_ID integer,
>primary key World_ID
>)
>
>create table Planets (
>World_ID integer,
>Planet_ID integer
>)
>
>ALTER TABLE Planets ADD FOREIGN KEY (World_ID) REFERENCES
>Worlds (World_ID) on delete cascade
>
>
>create table Stars (
>World_ID integer,
>Star_ID integer
>)
>
>ALTER TABLE Stars ADD FOREIGN KEY (World_ID) REFERENCES
>Worlds (World_ID) on delete cascade
>
>2. say you issue the command
>
>delete from Worlds
>
>Does FB deletes first Planets or Stars ?
>
>Is the sequence unpredictable ?
>
>If Planets and Stars are correlated, does FB any smart guess about
>the optimal sequence ?

On what basis do you think FB could "smart-guess" or determine an optimal
sequence for two constraints that are unrelated to each other?

At best, it might perform the cascade on the basis of the creation order of
the foreign keys, or some other arbitrary metadata thing -- alphabetical
order? Have you considered running your own predictability tests?

heLen