Skip to content

Apply foreign key constraints to UPDATE JOIN #3037

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

Merged
merged 16 commits into from
Jun 21, 2025
Merged

Apply foreign key constraints to UPDATE JOIN #3037

merged 16 commits into from
Jun 21, 2025

Conversation

angelamayxie
Copy link
Contributor

@angelamayxie angelamayxie commented Jun 17, 2025

Modified UpdateJoin to be able to apply foreign key constraints

Part of dolthub/dolt#9356

@angelamayxie angelamayxie requested a review from fulghum June 18, 2025 23:04
@angelamayxie angelamayxie marked this pull request as ready for review June 18, 2025 23:21
Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good! A couple of small suggestions to try out and see if it helps tidy things up.

return updaterMap, nil
}

// UpdatableJoinTable manages the update of multiple tables.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine for fixing foreign keys, but as we look at making triggers work correctly, it's worth thinking about if this is the right type here... UpdatableJoinTable implements sql.UpdateableTable, but many of it's methods panic and can't be used (e.g. Name() doesn't make sense when this can actually represent multiple tables with different names). That's a good sign that this isn't modeled as well as it should be. This also causes a problem in Doltgres, where the code is assuming that since it's an sql.UpdatableTable implementation, that it can act as a sql.Table and call other methods like Name().

No need to change this now, but I'd dig into cleaning this incongruence when we look at getting triggers to work across all tables.

Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@angelamayxie angelamayxie merged commit 220353c into main Jun 21, 2025
8 of 12 checks passed
@angelamayxie angelamayxie deleted the updatejoin branch June 21, 2025 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants