Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
AilinKid committed Mar 19, 2020
1 parent 9254493 commit 9bf6ef1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions executor/insert_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,10 @@ func (e *InsertValues) getColDefaultValue(idx int, col *table.Column) (d types.D
}

var defaultVal types.Datum
if !col.DefaultIsExpr {
defaultVal, err = table.GetColDefaultValue(e.ctx, col.ToInfo())
} else {
if col.DefaultIsExpr && col.DefaultExpr != nil {
defaultVal, err = table.EvalColDefaultExpr(e.ctx, col.ToInfo(), col.DefaultExpr)
} else {
defaultVal, err = table.GetColDefaultValue(e.ctx, col.ToInfo())
}
if err != nil {
return types.Datum{}, err
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lawyerphx/parser v0.0.0-20200316023126-7af13c9e0b85 h1:my5oTuBLzT1knvQnwaF7RXxNuzvzqhioNM8OcHYF2/A=
github.com/lawyerphx/parser v0.0.0-20200316023126-7af13c9e0b85/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4=
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
Expand Down
6 changes: 3 additions & 3 deletions planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1821,10 +1821,10 @@ func (b *PlanBuilder) getDefaultValue(col *table.Column) (*expression.Constant,
value types.Datum
err error
)
if !col.DefaultIsExpr {
value, err = table.GetColDefaultValue(b.ctx, col.ToInfo())
} else {
if col.DefaultIsExpr && col.DefaultExpr != nil {
value, err = table.EvalColDefaultExpr(b.ctx, col.ToInfo(), col.DefaultExpr)
} else {
value, err = table.GetColDefaultValue(b.ctx, col.ToInfo())
}
if err != nil {
return nil, err
Expand Down

0 comments on commit 9bf6ef1

Please sign in to comment.