-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Update Cascade Planning leading to Foreign key constraint verification #13902
Update Cascade Planning leading to Foreign key constraint verification #13902
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
// Each child foreign key constraint is verified by a join query of the form: | ||
// select 1 from child_tbl join parent_tbl on <columns in fk> where <clause same as original update> limit 1 | ||
// E.g: | ||
// Child (c1, c2) references Parent (p1, p2) | ||
// update Parent set p1 = 1 where id = 1 | ||
// verify query: | ||
// select 1 from Child join Parent on Parent.p1 = Child.c1 and Parent.p2 = Child.c2 | ||
// where Parent.id = 1 limit 1 | ||
func createFkVerifyOpForChildFKForUpdate(ctx *plancontext.PlanningContext, updStmt *sqlparser.Update, cFk vindexes.ChildFKInfo) (ops.Operator, error) { | ||
// ON UPDATE RESTRICT foreign keys that require validation, should only be allowed in the case where we |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should not fail the verify when updating to the same value.
{ | ||
"comment": "update with fk on cross-shard with a where condition on non-literal value - disallowed", | ||
"query": "update tbl3 set coly = colx + 10 where coly = 10", | ||
"plan": "VT12001: unsupported: foreign keys management at vitess with non-literal values" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can come up with a better error message for this limitation. this one is a little hard to decipher, imho
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
…rimitive for foreign key constraint verification Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
…cks 0 and validate all the foreign keys on vtgate Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
…herever required Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
b81e8e2
to
fa6f6d1
Compare
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Description
This PR adds two planning support
Related Issue(s)
Checklist