min_scale()

一个返回表示值所需最小精度(小数位数)的函数

min_scale() 是一个系统函数,用于返回表示给定值所需的最小精度(小数位数)。

min_scale() 函数是在 PostgreSQL 13 中添加的。

用法

min_scale ( numeric ) → integer

变更历史

示例

min_scale() 函数的执行示例

postgres=# SELECT min_scale(1.2300);
 min_scale
-----------
         2
(1 row)

postgres=# SELECT min_scale(1.23);
 min_scale
-----------
         2
(1 row)

postgres=# SELECT min_scale(1.0);
 min_scale
-----------
         0
(1 row)

postgres=# SELECT min_scale(1);
 min_scale
-----------
         0
(1 row)

分类

系统函数

另请参阅

scale(), trim_scale()

反馈

请在此 提交关于“min_scale()”的任何评论、建议或更正