You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@m-schieder@reicda@rrenkert
Since we can't guarantee the sequence of create events/write requests in current development, we have to set all foreign key constraints deferred.
Simple example:
agenda_item/1 with a content_object_id motion/5 should be inserted into db
There exist following foreign key constraint: ALTER TABLE agenda_item_t ADD FOREIGN KEY(content_object_id_motion_id) REFERENCES motion_t(id);
There is no problem inserting the motion/5 first and afterwards the agenda_item/1. The opposite is not true: Inserting the agenda_item/1 with the field content_object_id motion/5 first, throws ForeignKeyViolation: insert or update on table "agenda_item_t" violates foreign key constraint "agenda_item_t_content_object_id_motion_id_fkey", because the constraint is checked immediately. To move the check to the end of transaction we will change all foreign key constraints to the form ALTER TABLE agenda_item_t ADD FOREIGN KEY(content_object_id_motion_id) REFERENCES motion_t(id) INITIALLY DEFERRED;
Solving this issue we will write a new issue to revert this and try to remove the INITIALLY DEFERRED, because we expect it to be a time and/or memory penalty
The text was updated successfully, but these errors were encountered:
@m-schieder @reicda @rrenkert
Since we can't guarantee the sequence of create events/write requests in current development, we have to set all foreign key constraints
deferred
.Simple example:
motion/5
should be inserted into dbALTER TABLE agenda_item_t ADD FOREIGN KEY(content_object_id_motion_id) REFERENCES motion_t(id);
There is no problem inserting the motion/5 first and afterwards the agenda_item/1. The opposite is not true: Inserting the agenda_item/1 with the field content_object_id
motion/5
first, throwsForeignKeyViolation: insert or update on table "agenda_item_t" violates foreign key constraint "agenda_item_t_content_object_id_motion_id_fkey"
, because the constraint is checked immediately. To move the check to the end of transaction we will change all foreign key constraints to the formALTER TABLE agenda_item_t ADD FOREIGN KEY(content_object_id_motion_id) REFERENCES motion_t(id) INITIALLY DEFERRED;
Solving this issue we will write a new issue to revert this and try to remove the INITIALLY DEFERRED, because we expect it to be a time and/or memory penalty
The text was updated successfully, but these errors were encountered: