diff --git a/go/libraries/doltcore/schema/typeinfo/int.go b/go/libraries/doltcore/schema/typeinfo/int.go index 0a7e94b08b..fc862c5f93 100644 --- a/go/libraries/doltcore/schema/typeinfo/int.go +++ b/go/libraries/doltcore/schema/typeinfo/int.go @@ -144,7 +144,8 @@ func (ti *intType) Equals(other TypeInfo) bool { return false } if ti2, ok := other.(*intType); ok { - return ti.sqlIntType.Type() == ti2.sqlIntType.Type() + return ti.sqlIntType.Type() == ti2.sqlIntType.Type() && + ti.sqlIntType.DisplayWidth() == ti2.sqlIntType.DisplayWidth() } return false } diff --git a/go/libraries/doltcore/schema/typeinfo/typeinfo.go b/go/libraries/doltcore/schema/typeinfo/typeinfo.go index 94dac92b57..d354b44e49 100644 --- a/go/libraries/doltcore/schema/typeinfo/typeinfo.go +++ b/go/libraries/doltcore/schema/typeinfo/typeinfo.go @@ -144,26 +144,13 @@ func FromSqlType(sqlType sql.Type) (TypeInfo, error) { switch queryType { case sqltypes.Null: return UnknownType, nil - case sqltypes.Int8: - return Int8Type, nil - case sqltypes.Int16: - return Int16Type, nil - case sqltypes.Int24: - return Int24Type, nil - case sqltypes.Int32: - return Int32Type, nil - case sqltypes.Int64: - return Int64Type, nil - case sqltypes.Uint8: - return Uint8Type, nil - case sqltypes.Uint16: - return Uint16Type, nil - case sqltypes.Uint24: - return Uint24Type, nil - case sqltypes.Uint32: - return Uint32Type, nil - case sqltypes.Uint64: - return Uint64Type, nil + case sqltypes.Int8, sqltypes.Int16, sqltypes.Int24, sqltypes.Int32, sqltypes.Int64, + sqltypes.Uint8, sqltypes.Uint16, sqltypes.Uint24, sqltypes.Uint32, sqltypes.Uint64: + numberType, ok := sqlType.(sql.NumberType) + if !ok { + return nil, fmt.Errorf("expected sql.NumberType, but received: %T", sqlType) + } + return &intType{numberType}, nil case sqltypes.Float32: return Float32Type, nil case sqltypes.Float64: diff --git a/go/libraries/doltcore/schema/typeinfo/uint.go b/go/libraries/doltcore/schema/typeinfo/uint.go index 78c3bde98b..1d21f1e91a 100644 --- a/go/libraries/doltcore/schema/typeinfo/uint.go +++ b/go/libraries/doltcore/schema/typeinfo/uint.go @@ -144,7 +144,8 @@ func (ti *uintType) Equals(other TypeInfo) bool { return false } if ti2, ok := other.(*uintType); ok { - return ti.sqlUintType.Type() == ti2.sqlUintType.Type() + return ti.sqlUintType.Type() == ti2.sqlUintType.Type() && + ti.sqlUintType.DisplayWidth() == ti2.sqlUintType.DisplayWidth() } return false }