-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
47483: sql: fix casting of negative datums to decimals r=rytaft a=rytaft Prior to this commit, when negative intervals, timestamps, and timestamptzs were cast to decimals, the result was incorrect. The problem was due to the fact that for these negative values, `Decimal.Coeff.neg` was being set to true, while `Decimal.Negative` was false. As explained in the comment in `decimal.go`, "Coeff must be positive. If it is negative results may be incorrect and apd may panic." This commit fixes the problem by setting `Decimal.Negative` to true and `Decimal.Coeff.neg` to false when casting negative datums to decimals. Fixes #47327 Release note (bug fix): Fixed incorrect results that could occur when casting negative intervals or timestamps to type decimal. Co-authored-by: Rebecca Taft <[email protected]>
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters