Skip to content
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

plan: update comment wording #7238

Merged
merged 2 commits into from
Aug 2, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions plan/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,10 +1088,10 @@ func (b *planBuilder) buildValuesListOfInsert(insert *ast.InsertStmt, insertPlan
return
}

// If the value_list and col_list is empty and we have generated column, we can still write to this table.
// i.e. insert into t values(); can be executed successfully if t have generated column.
// If value_list and col_list are empty and we have a generated column, we can still write data to this table.
// For example, insert into t values(); can be executed successfully if t has a generated column.
if len(insert.Columns) > 0 || len(insert.Lists[0]) > 0 {
// If value_list is not empty or the col_list is not empty, length of value_list should be the same with col_list's.
// If value_list or col_list is not empty, the length of value_list should be the same with that of col_list.
if len(insert.Lists[0]) != len(affectedValuesCols) {
b.err = ErrWrongValueCountOnRow.GenByArgs(1)
return
Expand All @@ -1107,7 +1107,7 @@ func (b *planBuilder) buildValuesListOfInsert(insert *ast.InsertStmt, insertPlan

totalTableCols := insertPlan.Table.Cols()
for i, valuesItem := range insert.Lists {
// The length of the all the value_list should be the same.
// The length of all the value_list should be the same.
// "insert into t values (), ()" is valid.
// "insert into t values (), (1)" is not valid.
// "insert into t values (1), ()" is not valid.
Expand Down Expand Up @@ -1156,7 +1156,7 @@ func (b *planBuilder) buildSelectPlanOfInsert(insert *ast.InsertStmt, insertPlan
return
}

// Check that the length of select' row is equal to the col list.
// Check to guarantee that the length of the row returned by select is equal to that of affectedValuesCols.
if selectPlan.Schema().Len() != len(affectedValuesCols) {
b.err = ErrWrongValueCountOnRow.GenByArgs(1)
return
Expand Down