postgresql 中的十进制数据类型和数字数据类型有什么区别?我在手册中没有发现任何区别。
问问题
3041 次
2 回答
2
PostgreSQL 没有区别。根据文档:
类型
decimal
和numeric
是等价的。这两种类型都是 SQL 标准的一部分。
于 2014-02-19T09:53:51.870 回答
0
引自:https ://www.postgresql.org/message-id/20211.1325269672@sss.pgh.pa.us
在 Postgres 中没有任何区别。有两种类型名称,因为 SQL 标准要求我们接受这两种名称。快速浏览一下标准,似乎唯一的区别是:
17)NUMERIC specifies the data type exact numeric, with the decimal precision and scale specified by the <precision> and <scale>. 18)DECIMAL specifies the data type exact numeric, with the decimal scale specified by the <scale> and the implementation-defined decimal precision equal to or greater than the value of the specified <precision>.
即,对于 DECIMAL,实现允许在小数点左侧允许比请求更多的数字。Postgres 不行使这种自由,因此对我们来说这些类型之间没有区别。
regards, tom lane
于 2017-04-26T03:24:27.770 回答