Update a primary key and Fk
Hello
I have to update a primary key (PK) which is referenced by many foreign keys (FK).
The primary key columns cannot be updated as this would orphan the dependant tables,
and the dependant tables cannot be updated prior to the parent table as this would also make them orphans.
I think this problem was solved by disabling the foreign key constraints or deleting the original records and recreating them.
Since neither of these solutions is particularly satisfactory for me I read about 'deferred constraints'.
My question is:
Can I use(modify to) 'INITIALLY DEFERRED' keyword on constraints's table already created with The default, INITIALLY IMMEDIATE ,
that is, update my primary key and foreign keys, and then re-set to
'INITIALLY IMMEDIATE'? Or another trick exists ?
Thanks in advance for your attention