Apply foreign key constraints to UPDATE JOIN#3037
Conversation
…oin node, need to implement joinUpdater
fulghum
left a comment
There was a problem hiding this comment.
Looks pretty good! A couple of small suggestions to try out and see if it helps tidy things up.
sql/plan/update_join.go
Outdated
| return updaterMap, nil | ||
| } | ||
|
|
||
| // UpdatableJoinTable manages the update of multiple tables. |
There was a problem hiding this comment.
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.
Modified UpdateJoin to be able to apply foreign key constraints
Part of dolthub/dolt#9356