Skip to content

Commit 0c4bc3a

Browse files
author
James Cor
committed
fix
1 parent b8a3c4b commit 0c4bc3a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

enginetest/queries/index_queries.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4387,7 +4387,13 @@ var IndexQueries = []ScriptTest{
43874387
},
43884388
{
43894389
Query: "alter table t drop index notanidx",
4390-
ExpectedErr: sql.ErrDuplicateKey,
4390+
ExpectedErr: sql.ErrCantDropFieldOrKey,
4391+
},
4392+
{
4393+
Query: "alter table t drop index if exists notanidx",
4394+
Expected: []sql.Row{
4395+
{types.NewOkResult(0)},
4396+
},
43914397
},
43924398
},
43934399
},

sql/rowexec/ddl_iters.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,9 @@ func (b *BaseBuilder) executeAlterIndex(ctx *sql.Context, n *plan.AlterIndex) er
21232123
}
21242124
err = idxAltTbl.DropIndex(ctx, n.IndexName)
21252125
if err != nil {
2126+
if sql.ErrIndexNotFound.Is(err) && n.IfExists {
2127+
return nil
2128+
}
21262129
return err
21272130
}
21282131
return nil

0 commit comments

Comments
 (0)