插入數(shù)據(jù)時(shí)遇到上述標(biāo)題錯(cuò)誤葛假,發(fā)現(xiàn)是nextval error.
# 查看表最大id
SELECT MAX(id) FROM area;
-----------------------------------------------
max
-----
630
(1 row)
------------------------------------------------
# 查看該表nextval
SELECT nextval('area_id_seq');
------------------------------------------------
max
-----
630
(1 row)
------------------------------------------------
# 執(zhí)行修改序列
SELECT setval('area_id_seq', (SELECT MAX(id) FROM area)+1);
------------------------------------------------
setval
--------
631
(1 row)
------------------------------------------------