-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
ddl: fill in original default for extra writable columns in batch insert (#40198) #51145
ddl: fill in original default for extra writable columns in batch insert (#40198) #51145
Conversation
Signed-off-by: YangKeao <yangkeao@chunibyo.icu>
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.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Benjamin2037, tangenta The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/retest |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## release-6.5 #51145 +/- ##
================================================
Coverage ? 73.6206%
================================================
Files ? 1094
Lines ? 350623
Branches ? 0
================================================
Hits ? 258131
Misses ? 75910
Partials ? 16582 |
This is an automated cherry-pick of #40198
Signed-off-by: YangKeao yangkeao@chunibyo.icu
What problem does this PR solve?
Issue Number: close #40192, close #50993
Problem Summary:
When a column is in write-only state, the
INSERT ignore
statement without specifying columns doesn't fill in the origin default value.INSERT
actually works, because it appends, seetidb/table/tables/tables.go
Lines 798 to 813 in 95f0dc5
This case can also work well with unique index (if the origin default value is NULL) and NOT NULL.
It also avoids inserting more than 1 rows if the columns is NOT NULL and write-only (as the user cannot set a value for it). I doubt whether it is expected. (However, many other places depend on this behavior, and as I've tried, modifying this behavior is really scarying... I didn't touch it in this PR).
What is changed and how it works?
Append the origin default value if there are extra write-only column.
Check List
Tests
Release note