Skip to content

Commit

Permalink
online ddl support
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongjiwei committed Dec 21, 2022
1 parent 9e93d31 commit f53125c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,11 @@ error = '''
Incorrect usage of %s and %s
'''

["ddl:1235"]
error = '''
This version of TiDB doesn't yet support '%s'
'''

["ddl:1246"]
error = '''
Converting column '%s' from %s to %s
Expand Down
2 changes: 1 addition & 1 deletion expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ func ColumnInfos2ColumnsAndNames(ctx sessionctx.Context, dbName, tblName model.C
if err != nil {
return nil, nil, errors.Trace(err)
}
e, err := RewriteAstExpr(ctx, expr, mockSchema, names, false)
e, err := RewriteAstExpr(ctx, expr, mockSchema, names, true)
if err != nil {
return nil, nil, errors.Trace(err)
}
Expand Down
11 changes: 11 additions & 0 deletions expression/multi_valued_index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,15 @@ func TestMultiValuedIndexDDL(t *testing.T) {
tk.MustGetErrCode("create table t(j json, gc json as (cast(j->'$[*]' as unsigned array)));", errno.ErrNotSupportedYet)
tk.MustGetErrCode("create view v as select cast('[1,2,3]' as unsigned array);", errno.ErrNotSupportedYet)
tk.MustExec("create table t(a json, index idx((cast(a as signed array))));")

tk.MustExec("drop table t")
tk.MustGetErrCode("create table t(a json, b int, index idx(b, (cast(a as signed array)), (cast(a as signed array))));", errno.ErrNotSupportedYet)
tk.MustExec("create table t(a json, b int);")
tk.MustGetErrCode("create index idx on t (b, (cast(a as signed array)), (cast(a as signed array)))", errno.ErrNotSupportedYet)
tk.MustGetErrCode("alter table t add index idx(b, (cast(a as signed array)), (cast(a as signed array)))", errno.ErrNotSupportedYet)
tk.MustExec("create index idx1 on t (b, (cast(a as signed array)))")
tk.MustExec("alter table t add index idx2(b, (cast(a as signed array)))")

tk.MustExec("drop table t")
tk.MustExec("create table t(a json, b int, index idx3(b, (cast(a as signed array))));")
}

0 comments on commit f53125c

Please sign in to comment.