在PG里面
1、整数类型包括3种,分别是smallint、int和bigint。别名分别是int2、int(int4)和int8.常用数据类型是int(integer)
2、浮点类型分为精确浮点数类型numeric和不精确浮点数类型real(单精度浮点数据类型)和 double precision(双精度浮点数据类型)。
3、样例:
CREATE TABLE test (id numeric(2,2)); INSERT into test VALUES(1.2345); --插入超过精度和标度的值 --报错信息 ERROR: numeric field overflow DETAIL: A field with precision 2, scale 2 must round to an absolute value less than 1. INSERT into test VALUES(0.2345); --插入超过标度的值,超过标度的部分被四舍五入成小于1的数,这里0.2345插入数据库的值为0.23
4、PG中文社区文档 更多详情
原文:https://www.cnblogs.com/whaleX/p/12703924.html