aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw44@gmail.com>2019-05-03 10:10:19 +0800
committerTing-Wei Lan <tingwei.lan@cobinhood.com>2019-05-14 11:04:15 +0800
commitba0d231fbe274063a056e47d4e8c092adff0b5c0 (patch)
tree0c965b30d6cc7747ddc5f7c3462fbec17efc13e3
parent2a3c144a7872b33ecadb4448130f0df90828cac9 (diff)
downloaddexon-ba0d231fbe274063a056e47d4e8c092adff0b5c0.tar.gz
dexon-ba0d231fbe274063a056e47d4e8c092adff0b5c0.tar.zst
dexon-ba0d231fbe274063a056e47d4e8c092adff0b5c0.zip
code backup 27
-rw-r--r--core/vm/sqlvm/checker/checker.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/core/vm/sqlvm/checker/checker.go b/core/vm/sqlvm/checker/checker.go
index f18f9bc3f..5a2832c50 100644
--- a/core/vm/sqlvm/checker/checker.go
+++ b/core/vm/sqlvm/checker/checker.go
@@ -722,22 +722,6 @@ func checkCreateIndexStmt(n *ast.CreateIndexStmtNode, s *schema.Schema,
index := schema.Index{}
index.Columns = columnRefs.columns
- if len((*s)[td.Table].Indices) > schema.MaxIndexRef {
- el.Append(errors.Error{
- Position: n.GetPosition(),
- Length: n.GetLength(),
- Category: errors.ErrorCategoryLimit,
- Code: errors.ErrorCodeTooManyIndices,
- Severity: errors.ErrorSeverityError,
- Prefix: fn,
- Message: fmt.Sprintf(
- "cannot have more than %d indices in table %s",
- schema.MaxIndexRef+1,
- ast.QuoteIdentifier(tn)),
- }, &hasError)
- return
- }
-
ir := schema.IndexRef(len((*s)[td.Table].Indices))
id := schema.IndexDescriptor{Table: td.Table, Index: ir}
if n.Unique != nil {
@@ -806,6 +790,21 @@ func checkCreateIndexStmt(n *ast.CreateIndexStmtNode, s *schema.Schema,
if rename {
(*s)[id.Table].Indices[id.Index].Name = n.Index.Name
} else {
+ if len((*s)[td.Table].Indices) > schema.MaxIndexRef {
+ el.Append(errors.Error{
+ Position: n.GetPosition(),
+ Length: n.GetLength(),
+ Category: errors.ErrorCategoryLimit,
+ Code: errors.ErrorCodeTooManyIndices,
+ Severity: errors.ErrorSeverityError,
+ Prefix: fn,
+ Message: fmt.Sprintf(
+ "cannot have more than %d indices in table %s",
+ schema.MaxIndexRef+1,
+ ast.QuoteIdentifier(tn)),
+ }, &hasError)
+ return
+ }
index.Name = n.Index.Name
(*s)[id.Table].Indices = append((*s)[id.Table].Indices, index)
}