postgresql 备份数据库遇到的坑,relation "XXX_id_seq" does not exist

@cllily

progresql 备份数据库遇到的坑relation “XXX_id_seq” does not exist

 从mysql 数据库转用psotgresql ,练手的时候打算备份数据库,转存sql脚本
 运行sql脚本的时候数据和结构都刷不过来,于是检查sql脚本和报错,一直报relation "performance_id_seq" does not exist ,查阅文档得知:
 在postgresql表中建立了自增字段,id定义为Serial 类型,当执行完成建表语句后,其字段便成:
		 "id" int4 NOT NULL DEFAULT nextval('performance_id_seq'::regclass) 
 这种形式
 但是导出sql脚本时候直接定义成这种形式,postgresql不能识别,想必是postgresql的一个小bug吧,因此自增的id,在建表的时候应该定义为:
 		“id”  serial

你可能感兴趣的:(数据库_postgresql)