Starting off with:
Parent (Rule on insert instead insert into Child2)
Child1 (Constraint date <= somedate1)
Child2 (Constraint date > somedate1)
Child1 (Constraint date <= somedate1)
Child2 (Constraint date > somedate1)
Now I want to create another Partition:
Create Table Child3
BEGIN
Update Parent Rule( instead insert into Child3)
somedate2 = max(date) from Child2
Update Child2 Constraint( date > somedate1 AND date <= somedate2 )
Set Constraint Child3 (date > somedate2)
END
BEGIN
Update Parent Rule( instead insert into Child3)
somedate2 = max(date) from Child2
Update Child2 Constraint( date > somedate1 AND date <= somedate2 )
Set Constraint Child3 (date > somedate2)
END
Which ends up with:
Parent (Rule on insert instead insert into Child2)
Child1 (Constraint date <= somedate1)
Child2 (Constraint date > somedate1 AND date <= somedate2)
Child3 (Constraint date > somedate2)
Anyone else tried this or expect it to work consistently (without stopping db)? Is it possible that there could be a race condition for the insertion and constraints or will the transaction prevent that from occurring? I've done some testing and it seems to work but I could just get lucky so far and not lose any data :)
Thanks for any help,
Gene