Date:2012-12-13
Env:Postgresql 9.2,pgAdmin3
1.//字段包含大写时导致插入失败
创建表(从pgAdmin3截取):
CREATE TABLE county ( "provinceId" character(2) NOT NULL,"cityId" character(2) NOT NULL,"countyId" character(2) NOT NULL,"countyName" character varying(20) NOT NULL,CONSTRAINT cou_pk PRIMARY KEY ("provinceId","cityId","countyId") )
执行sql:
INSERT INTO county (provinceId,cityId,countyId,countyName) VALUES ('11','02','29','延庆县')
结果:pgAdmin3提示:错误: 关系 "county" 的 "provinceid" 字段不存在
sql 状态: 42703
分析与修正:Postgresl字段或表名不加引号是不区分大小写,如果字段或表名有大小写就必须加引号.建议字段命名方式:xxx_xxx,用"_"分隔.
chenhao=> select to_char(1,'00'); to_char --------- 01 (1 row)
3.//integer保存unix时间戳的2038bug
原因:32位的数从0-0xFFFFFFFF秒,大概到2038年unix时间戳将会溢出.Fix:使用bigint.
Postgre资料汇总
http://francs3.blog.163.com/blog/static/405767272014017341219/