Skip to content

Apply foreign key constraints to UPDATE JOIN#3037

Merged
angelamayxie merged 16 commits intomainfrom
updatejoin
Jun 21, 2025
Merged

Apply foreign key constraints to UPDATE JOIN#3037
angelamayxie merged 16 commits intomainfrom
updatejoin

Conversation

@angelamayxie
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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