1.数字类型
整型:smallint 2byte 、 integer 4byte、 bigint 8byte
任意精度数组:decimal和numeric 可变,用户指定精度。23.5141==numeric(6,4)
浮点类型:real 4byte和double precision 8byte。
序数类型:smallserial 2byte、 serial 4byte、 bigserial 8byte.不是真正的类型,是为了创建唯一标识而存在的方便符号
类似于其他数据库中的auto_increment
2.货币类型
money 8bytes
3.字符类型
变长 character varying(n),varchar(n)
定长,空格填充 character(n),char(n)
无限变长 text
4.二进制数据类型
bytea 1或4bytes
5.日期和时间类型
timestamp
6.布尔类型
boolean 1bytes
7.枚举类型
enum是由一个静态、值的有序集合构成的数据类型,4bytes,大小写敏感
create type mood as ENUM('sad','ok','happy');
create table person(name text,current_mood mood);
8.几何类型,表示二维的空间物体
point 16bytes 平面上的点 (x,y)
line 32bytes 无限长的线 {A,B,C}
lseg 32bytes 有限线段 ((x1,y1),(x2,y2))
box 32bytes 矩形框 ((x1,y1),(x2,y2))
circle 24bytes 圆
9.网络地址类型
cidr 7或19bytes ipv4和ipv6网络
inet 7或19bytes ipv4和ipv6主机以及网络
macaddr 6bytes Mac地址




