Skip to content

Commit b12819e

Browse files
committed
amend e.typ to update on non-literals
1 parent 76ed7ec commit b12819e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sql/expression/arithmetic.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,16 +710,19 @@ func (e *UnaryMinus) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
710710
return -n, nil
711711
case int8:
712712
if n == math.MinInt8 {
713+
e.typ = types.Int16 // For non-literals to update
713714
return -int16(n), nil
714715
}
715716
return -n, nil
716717
case int16:
717718
if n == math.MinInt16 {
719+
e.typ = types.Int32
718720
return -int32(n), nil
719721
}
720722
return -n, nil
721723
case int32:
722724
if n == math.MinInt32 {
725+
e.typ = types.Int64
723726
return -int64(n), nil
724727
}
725728
return -n, nil

0 commit comments

Comments
 (0)