更新索引至最大值:select setval(‘"demo".test_id_seq‘, (SELECT MAX("id") FROM demo.test));
查询下一个序列值:select nextval(‘"demo".test_id_seq‘);
解决Pg新增数据主键冲突
原文:https://www.cnblogs.com/az4215/p/12468846.html