Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions enginetest/queries/alter_table_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,29 @@ var AlterTableScripts = []ScriptTest{
},
},
},
{
// https://github.com/dolthub/dolt/issues/9178
Name: "alter modify column type float to bigint",
SetUpScript: []string{
"create table t1 (pk int primary key, c1 float);",
"insert into t1 values (1, 0.0)",
"insert into t1 values (2, 127.9)",
"insert into t1 values (3, 42.1)",
},
Assertions: []ScriptTestAssertion{
{
Query: "alter table t1 modify column c1 bigint",
},
{
Query: "select * from t1 order by pk",
Expected: []sql.Row{
{1, int64(0)},
{2, int64(128)},
{3, int64(42)},
},
},
},
},
}

var RenameTableScripts = []ScriptTest{
Expand Down
2 changes: 1 addition & 1 deletion enginetest/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -11791,6 +11791,6 @@ func MustParseTime(layout, value string) time.Time {

func UnixTimeInLocal(sec, nsec int64) time.Time {
t := time.Unix(sec, nsec)
_, offset := t.Zone()
_, offset := time.Now().Zone()
return t.Add(time.Second * time.Duration(offset)).In(time.UTC)
}
2 changes: 1 addition & 1 deletion sql/types/number.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ func convertToInt64(t NumberTypeImpl_, v interface{}) (int64, sql.ConvertInRange
} else if v < float32(math.MinInt64) {
return math.MinInt64, sql.OutOfRange, nil
}
return int64(math.Round(float64(v))), sql.OutOfRange, nil
return int64(math.Round(float64(v))), sql.InRange, nil
case float64:
if v > float64(math.MaxInt64) {
return math.MaxInt64, sql.OutOfRange, nil
Expand Down
Loading