trim_scale() 是一个系统函数,它通过移除尾随零来减少给定值的精度(小数位数)。
trim_scale() 在 PostgreSQL 13 中添加。
示例
trim_scale() 的基本执行示例
postgres=# SELECT trim_scale(1.2300);
trim_scale
------------
1.23
(1 row)
如果没有尾随零,trim_scale() 将不起作用
postgres=# SELECT trim_scale(1.23);
trim_scale
------------
1.23
(1 row)
参考资料
- PostgreSQL 文档: 数学函数
