Skip to content

incorrect cascading deletes in cases of non-primary foreign keys #4

Closed
@dimitri-yatsenko

Description

@dimitri-yatsenko

Currently, DataJoint implements its own cascading deletes instead of relying on MySQL's native cascading deletes.

This solution

  • allows reviewing the contents to be deleted
  • compensates for MySQL's multiple-path problem for cascading deletes

dj.BaseRelvar/del generates the lists of all dependent tables and deletes from them, starting from the bottom. Each delete is restricted by the top relation. This rule works well when all foreign key fields are also primary key fields in the tables involved but can result in deleting non-dependent tuples if one of the tables along the cascade includes non-primary fields in its foreign key.

This issue may be fixed by simply not cascading down from any table that does not include all its foreign key fields in their primary key.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions