trim_scale()

A function reducing the value's scale by removing trailing zeroes

trim_scale() is a system function which reduces the scale of the provided value (number of fractional decimal digits) by removing trailing zeroes.

trim_scale() was added in PostgreSQL 13.

Usage

trim_scale ( numeric ) → numeric

Change history

Examples

Basic execution example for trim_scale():

postgres=# SELECT trim_scale(1.2300);
 trim_scale
------------
       1.23
(1 row)

trim_scale() has no effect if there are no trailing zeroes:

postgres=# SELECT trim_scale(1.23);
 trim_scale
------------
       1.23
(1 row)

Categories

System function

See also

scale(), min_scale()