postgresql自增列

postgresql的自增列和mysql不一样。不同于mysql,如果手动插入不连续的值,则不会从最大的值自增。

insert into test values (1) ,(3)
mysql将不会有2, 后面的自增值将从4开始,而postgresql则从2开始自增,遇到3时报错如果是非唯一索引列的话。
自增列类型为serial
id serial

猜你喜欢

转载自lijun-19871023.iteye.com/blog/1728342