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 #254 #334

Merged
merged 12 commits into from
Oct 10, 2015
Merged

*: Fix #254 #334

merged 12 commits into from
Oct 10, 2015

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented Oct 9, 2015

Fix #254

@@ -489,9 +490,9 @@ func (d *ddl) addColumn(schema model.CIStr, tbl table.Table, spec *AlterSpecific
tb := tbl.(*tables.Table)
tb.Columns = newCols
// TODO: update index
// TODO: update default value
// update infomation schema
updateDefaultValue(ctx, tb, col)
Copy link
Member

Choose a reason for hiding this comment

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

Need error check.

_, err = tb.AddRecord(ctx, []interface{}{1})
_, err = tb.AddRecord(ctx, []interface{}{2})
c.Assert(err, IsNil)
alterStmt := statement(`alter table t2 add b enum("bbb") first`).(*stmts.AlterTableStmt)
Copy link
Member

Choose a reason for hiding this comment

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

Should add a test that after u add a new column, u can select the updated value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tb.Row() will get the updated values.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but need a value equal check.

return errors.Trace(err0)
}
k := t.RecordKey(handle, col)
colID, err0 := tables.ColumnID(k)
Copy link
Member

Choose a reason for hiding this comment

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

Seems that in addColumn there will be no new column, so here colID == col.ID will always be true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep.
here colID == col.ID is always true. Because the key is produced by RecordKey(handle, col)

@shenli
Copy link
Member

shenli commented Oct 10, 2015

LGTM

shenli added a commit that referenced this pull request Oct 10, 2015
@shenli shenli merged commit 631b453 into master Oct 10, 2015
@shenli shenli deleted the zimuxia/alter branch October 10, 2015 08:38
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
* optimize parse csv and local backend write tikv

* fix

* remove IndexAnyUtf8 because the implement buggy for csv parser

* update pebble and options
xhebox pushed a commit to xhebox/tidb that referenced this pull request Sep 28, 2021
xhebox pushed a commit to xhebox/tidb that referenced this pull request Oct 8, 2021
ti-chi-bot pushed a commit that referenced this pull request Oct 9, 2021
iosmanthus pushed a commit to iosmanthus/tidb that referenced this pull request May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants