-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
*: support foreign key on update cascade and set null when execute update statement #38652
Conversation
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-all-tests |
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 suggest adding some comments explaning how it works. It's not so obvious at first sight.
Are there still any difficulties stopping us from building the AST instead of manipulating SQLs? I'm somewhat worried datum -> string(sql) -> datum may not be identical(?)
executor/foreign_key.go
Outdated
@@ -735,6 +824,8 @@ func genFKValueString(v types.Datum) (string, error) { | |||
switch v.Kind() { | |||
case types.KindInt64, types.KindUint64, types.KindFloat32, types.KindFloat64, types.KindMysqlDecimal: | |||
return val, nil | |||
case types.KindNull: | |||
return "NULL", err | |||
default: | |||
return "'" + val + "'", nil |
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.
Do all remaining types work well with '
?
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.
nice catch, I just add all types test in mysql_test/t/foreign_key_cascade_type.test
https://github.com/pingcap/tidb-test/pull/2000.
Signed-off-by: crazycs520 <[email protected]>
I'll try this later. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 9289c43
|
Signed-off-by: crazycs520 <[email protected]>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 9549cf0
|
TiDB MergeCI notify✅ Well Done! New fixed [3] after this pr merged.
|
What problem does this PR solve?
Issue Number: close #38651
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.