Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

del deletes some incorrect entries from downstream tables with renamed foreign keys #362

Closed
shenshan opened this issue Mar 25, 2021 · 1 comment · Fixed by #369
Closed
Assignees
Labels
Milestone

Comments

@shenshan
Copy link

Bug Report

Description

del deletes some unexpected entries from downstream tables when the foreign keys are renamed.

Reproducibility

dj version 3.4.2 maybe also in earlier versions. This was an old bug.

To reproduce, create the following tables:
+test/User.m

%{
# 
user_id                     : varchar(12)                   # 
%}

classdef User < dj.Manual
end

+test/Duty.m

%{
schedule:   varchar(32)
---
(monday_on_call) -> test.User(user_id)
%}

classdef Duty < dj.Manual
end

Then insert some data into the tables.

inserti(...
    test.User, ...
    { 'raphael'; 'shan'; 'chris'; 'thinh'})

inserti(...
    test.Duty, {'schedule1', 'shan'; 'schedule2', 'raphael'})

Now delete the user shan, it should delete 1 entry from the test.Duty table, but it tries to delete two entries.

>> del(test.User & 'user_id="shan"')

ABOUT TO DELETE:
       1 tuples from `test`.`user` (manual)
       2 tuples from `test`.`duty` (manual)

Proceed to delete? (yes/no) > 

If there is no renaming of foreign key, the delete was fine.

@shenshan shenshan added bug awaiting-triage Issues awaiting proper priority/milestone assignment. labels Mar 25, 2021
@guzman-raphael guzman-raphael added this to the Release 3.4.3 milestone Mar 26, 2021
@guzman-raphael guzman-raphael removed the awaiting-triage Issues awaiting proper priority/milestone assignment. label Mar 26, 2021
@guzman-raphael
Copy link
Collaborator

@shenshan Thanks for the report. This one is a pre-existing issue and a bit more involved to patch. It is at the top of the current priority and will keep you posted on any updates. There is a comment here in the source about this specifically too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants