Casts EXTRACT result as double precision in preparation for PG 14
What does this MR do and why?
Overview
As the EXTRACT function now returns numeric
instead of double precision
in PG14, these changes will ensure compatibility when we bump PG version.
As Rails treats numeric
value as BigDecimal
, .to_json
and .as_json
will cast BigDecimal
as a string. This behavior could lead to issues, because theses values will be represented as String
, instead of Float
.
PG 13
[
{
avg: -24.2183307368421053
}
]
PG 14
[
{
avg: "-24.2183307368421053"
}
]
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #398772 (closed)
Edited by Leonardo da Rosa