> On 23 Mar 2023, at 19:31, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> This behavior change happened with commit a2da77cdb
> (Change return type of EXTRACT to numeric), and it was intentional
> according to the commit log:
>
> - Return values when extracting fields with possibly fractional
> values, such as second and epoch, now have the full scale that the
> value has internally (so, for example, '1.000000' instead of just
> '1').
>
> But exactly nothing was mentioned of that in user-facing docs.
Skimming the thread it's also not really discussed much AFAICT. It's first
brought up in [0] as:
When extracting seconds or microseconds, I made it always produce 6 or
3 decimal places, even if they are zero. I don't know if we want that
or what behavior we want. That's what all the changes in the
regression tests are about. Everything else passes unchanged.
There are no follow-ups to that though.
> I wonder if we should rethink that and have these operations strip
> insignificant trailing zeroes.
Any app relying on insignificant trailing zeroes seems broken, but the inverse
can be argued as well. It's however quite easy to argue for the stripped
output being more readable though.
--
Daniel Gustafsson
[0] https://www.postgresql.org/message-id/a3be61d9-f44b-7fce-3dc8-d700fdfb6f48%402ndquadrant.com