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

*: Fix add index after add column with default value #3510

Merged
merged 5 commits into from
Jun 20, 2017

Conversation

zimulala
Copy link
Contributor

No description provided.

@shenli
Copy link
Member

shenli commented Jun 19, 2017

@zimulala CI failed.

@@ -673,6 +661,27 @@ func (t *Table) IterRecords(ctx context.Context, startKey kv.Key, cols []*table.
return nil
}

func GetColDefaultValue(ctx context.Context, col *table.Column, defaultVals []types.Datum) (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment.

if mysql.HasNotNullFlag(col.Flag) {
return nil, errors.New("Miss column")
}
v[i], err = GetColDefaultValue(ctx, col, defaultVals)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this before line 479?

ddl/index.go Outdated
}
idxColumnVal, ret.err = tables.GetColDefaultValue(ctx, col, defaultVals)
if ret.err != nil {
ret.err = errors.Trace(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -673,6 +661,27 @@ func (t *Table) IterRecords(ctx context.Context, startKey kv.Key, cols []*table.
return nil
}

func GetColDefaultValue(ctx context.Context, col *table.Column, defaultVals []types.Datum) (
Copy link
Member

@hanfei1991 hanfei1991 Jun 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can implement a GetAllColDefaultValues to return default values for every column at one time. Passing a slice every time is a little strange.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If implement a GetAllColDefaultValues, it will be an interface and its arguments are hard to understand. I tried and thought it was not very good. @hanfei1991

@zimulala
Copy link
Contributor Author

PTAL @shenli @hanfei1991

@zimulala zimulala added the type/bug The issue is confirmed as a bug. label Jun 20, 2017
@hanfei1991
Copy link
Member

LGTM

@hanfei1991 hanfei1991 added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 20, 2017
@shenli
Copy link
Member

shenli commented Jun 20, 2017

LGTM

@ngaut ngaut added type/bugfix This PR fixes a bug. and removed type/bug The issue is confirmed as a bug. labels Jun 20, 2017
@hanfei1991 hanfei1991 merged commit a5d1464 into master Jun 20, 2017
@hanfei1991 hanfei1991 deleted the zimuxia/ddl-index-defualt branch June 20, 2017 05:32
zimulala added a commit that referenced this pull request Jun 20, 2017
zimulala added a commit that referenced this pull request Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants