diff options
Diffstat (limited to 'core/vm')
-rw-r--r-- | core/vm/sqlvm/ast/ast.go | 8 | ||||
-rw-r--r-- | core/vm/sqlvm/checker/checker.go | 5 | ||||
-rw-r--r-- | core/vm/sqlvm/checker/utils.go | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/core/vm/sqlvm/ast/ast.go b/core/vm/sqlvm/ast/ast.go index 5868549a8..9b0efd8f3 100644 --- a/core/vm/sqlvm/ast/ast.go +++ b/core/vm/sqlvm/ast/ast.go @@ -79,7 +79,11 @@ func safeIdentifierExtend(r rune) bool { func safeString(s []byte, quote byte, mustQuote bool) []byte { o := bytes.Buffer{} - o.Grow(len(s) + 1) + if mustQuote { + o.Grow(len(s) + 2) + } else { + o.Grow(len(s) + 1) + } o.WriteByte(quote) if len(s) > 0 { @@ -316,7 +320,7 @@ func (n *AddressValueNode) IsConstant() bool { return true } -// GetType returns the type of 'bool'. +// GetType returns the type of 'address'. func (n *AddressValueNode) GetType() DataType { return ComposeDataType(DataTypeMajorAddress, DataTypeMinorDontCare) } diff --git a/core/vm/sqlvm/checker/checker.go b/core/vm/sqlvm/checker/checker.go index 5dcfaa043..f18f9bc3f 100644 --- a/core/vm/sqlvm/checker/checker.go +++ b/core/vm/sqlvm/checker/checker.go @@ -304,6 +304,11 @@ func checkCreateTableStmt(n *ast.CreateTableStmtNode, s *schema.Schema, } column.Attr |= schema.ColumnAttrHasDefault + // We should not do type checking on an invalid type. + if !column.Type.Valid() { + break cs + } + value := cs.Value value = checkExpr(cs.Value, *s, o|CheckWithConstantOnly, c, el, 0, newTypeActionAssign(column.Type)) diff --git a/core/vm/sqlvm/checker/utils.go b/core/vm/sqlvm/checker/utils.go index 3ca49676f..60a3f7c86 100644 --- a/core/vm/sqlvm/checker/utils.go +++ b/core/vm/sqlvm/checker/utils.go @@ -15,7 +15,7 @@ import ( // td -> table descriptor // tr -> table reference // ti -> table index -// tn -< table name +// tn -> table name // // cd -> column descriptor // cr -> column reference |