From 06cc381fa5b5caa211adcce03e43d00d37d31e28 Mon Sep 17 00:00:00 2001 From: c-wind Date: Fri, 4 Mar 2016 14:11:04 +0800 Subject: [PATCH] ddl:Delete the useless judgment --- ddl/index.go | 6 ------ ddl/index_test.go | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ddl/index.go b/ddl/index.go index 7332121e76..4f6d011402 100644 --- a/ddl/index.go +++ b/ddl/index.go @@ -28,12 +28,6 @@ import ( ) func buildIndexInfo(tblInfo *model.TableInfo, unique bool, indexName model.CIStr, indexID int64, idxColNames []*coldef.IndexColName) (*model.IndexInfo, error) { - for _, col := range tblInfo.Columns { - if col.Name.L == indexName.L { - return nil, errors.Errorf("CREATE INDEX: index name collision with existing column: %s", indexName) - } - } - // build offsets idxColumns := make([]*model.IndexColumn, 0, len(idxColNames)) for _, ic := range idxColNames { diff --git a/ddl/index_test.go b/ddl/index_test.go index ded6807a80..f037f3c2b0 100644 --- a/ddl/index_test.go +++ b/ddl/index_test.go @@ -612,6 +612,9 @@ func (s *testIndexSuite) TestAddIndex(c *C) { job := testCreateIndex(c, ctx, d, s.dbInfo, tblInfo, true, "c1_uni", "c1") testCheckJobDone(c, d, job, true) + job = testCreateIndex(c, ctx, d, s.dbInfo, tblInfo, true, "c1", "c1") + testCheckJobDone(c, d, job, true) + _, err = ctx.GetTxn(true) c.Assert(err, IsNil)