Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use max datetime precision for comparisons
  • Loading branch information
angelamayxie committed Oct 22, 2025
commit c5d4cc2c19a764d36b9069c235da5d81e2925ad3
10 changes: 6 additions & 4 deletions sql/expression/comparison.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,15 @@ func (c *comparison) castLeftAndRight(ctx *sql.Context, left, right interface{})
}

if types.IsTime(leftType) || types.IsTime(rightType) {
// TODO: We need to set to actual Datetime type
l, r, err := convertLeftAndRight(ctx, left, right, ConvertToDatetime)
l, _, err := types.DatetimeMaxPrecision.Convert(ctx, left)
if err != nil {
return nil, nil, nil, err
}

return l, r, types.DatetimeDefaultPrecision, nil
r, _, err := types.DatetimeMaxPrecision.Convert(ctx, right)
if err != nil {
return nil, nil, nil, err
}
return l, r, types.DatetimeMaxPrecision, nil
}

// Rely on types.JSON.Compare to handle JSON comparisons
Expand Down
Loading