From 20d6225d1656102534a73d9675bc531ff0e5203b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 6 Jan 2020 12:13:53 -0500 Subject: Add functions min_scale(numeric) and trim_scale(numeric). These allow better control of trailing zeroes in numeric values. Pavel Stehule, based on an old proposal of Marko Tiikkaja's; review by Karl Pinc Discussion: https://postgr.es/m/CAFj8pRDjs-navGASeF0Wk74N36YGFJ+v=Ok9_knRa7vDc-qugg@mail.gmail.com --- doc/src/sgml/func.sgml | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 57a1539506d..4b42f128625 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -918,6 +918,20 @@ 6.0000000000 + + + + min_scale + + min_scale(numeric) + + integer + minimum scale (number of fractional decimal digits) needed + to represent the supplied value + min_scale(8.4100) + 2 + + @@ -1011,8 +1025,8 @@ integer scale of the argument (the number of decimal digits in the fractional part) - scale(8.41) - 2 + scale(8.4100) + 4 @@ -1041,6 +1055,20 @@ 1.4142135623731 + + + + trim_scale + + trim_scale(numeric) + + numeric + reduce the scale (number of fractional decimal digits) by + removing trailing zeroes + trim_scale(8.4100) + 8.41 + + -- cgit v1.2.3